aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2011-01-06 20:06:52 +1000
committerRyan Bigg <radarlistener@gmail.com>2011-01-06 20:10:01 +1000
commitf612069ae157ba4312672d59dd844a01197cac9e (patch)
treed29e878ea61ed625e90d0858443dd027db29d6a1 /activerecord
parenta41d33431fa19a08aec52030aeb7225fefe7aa47 (diff)
downloadrails-f612069ae157ba4312672d59dd844a01197cac9e.tar.gz
rails-f612069ae157ba4312672d59dd844a01197cac9e.tar.bz2
rails-f612069ae157ba4312672d59dd844a01197cac9e.zip
Fix documentation for validates_uniqueness_of to NOT have a :scope argument as the prime example. Show scope examples after prime example.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/validations/uniqueness.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb
index 853808eebf..e6a2b40403 100644
--- a/activerecord/lib/active_record/validations/uniqueness.rb
+++ b/activerecord/lib/active_record/validations/uniqueness.rb
@@ -85,11 +85,16 @@ module ActiveRecord
# can be named "davidhh".
#
# class Person < ActiveRecord::Base
- # validates_uniqueness_of :user_name, :scope => :account_id
+ # validates_uniqueness_of :user_name
# end
#
- # It can also validate whether the value of the specified attributes are unique based on multiple
- # scope parameters. For example, making sure that a teacher can only be on the schedule once
+ # It can also validate whether the value of the specified attributes are unique based on a scope parameter:
+ #
+ # class Person < ActiveRecord::Base
+ # validates_uniqueness_of :user_name, :scope => :account_id
+ # end
+ #
+ # Or even multiple scope parameters. For example, making sure that a teacher can only be on the schedule once
# per semester for a particular class.
#
# class TeacherSchedule < ActiveRecord::Base