1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/validations
Emmanuel Oga 9b15e01c21 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.
```
2012-01-17 01:40:17 -03:00
..
association_validation_test.rb validate related records in the same validation context as parent. 2012-01-17 01:40:17 -03:00
i18n_generate_message_validation_test.rb please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
i18n_validation_test.rb please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
uniqueness_validation_test.rb allow association as 1st uniqueness validation arg 2012-01-06 19:17:36 -05:00