mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix documentation for validates_uniqueness_of to NOT have a :scope argument as the prime example. Show scope examples after prime example.
This commit is contained in:
parent
a41d33431f
commit
f612069ae1
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue