diff options
author | Emmanuel Oga <EmmanuelOga@gmail.com> | 2012-01-17 01:40:17 -0300 |
---|---|---|
committer | Emmanuel Oga <EmmanuelOga@gmail.com> | 2012-01-17 01:40:17 -0300 |
commit | 9b15e01c219013825275e7e10140d9883d148c8c (patch) | |
tree | a893172fca7e6311b8e035d6081f188d9fc33bae /activemodel/lib/active_model/mass_assignment_security/permission_set.rb | |
parent | 21afd9b96d70d1e2b1cffdfb60f7ec64ab240472 (diff) | |
download | rails-9b15e01c219013825275e7e10140d9883d148c8c.tar.gz rails-9b15e01c219013825275e7e10140d9883d148c8c.tar.bz2 rails-9b15e01c219013825275e7e10140d9883d148c8c.zip |
validate related records in the same validation context as parent.
E.G.:
```ruby
class Parent < ActiveRecord::Base
has_one :child
validates_presence_of :name, :on => "custom_context"
validates_associated :child
end
class Child < ActiveRecord::Base
belongs_to :parent
validates_presence_of :name, :on => "custom_context"
end
p = Parent.new(:name => "Montoto", :child => Child.new)
p.valid?(:custom_context) # => Returns true, even though the child is not valid under the same context.
```
Diffstat (limited to 'activemodel/lib/active_model/mass_assignment_security/permission_set.rb')
0 files changed, 0 insertions, 0 deletions