aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/validations/association_validation_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix validations on child record when record parent has validate: falseeileencodes2015-02-011-2/+1
| | | | | | | | | | | | | | Fixes #17621. This 5 year old (or older) issue causes validations to fire when a parent record has `validate: false` option and a child record is saved. It's not the responsibility of the model to validate an associated object unless the object was created or modified by the parent. Clean up tests related to validations `assert_nothing_raised` is not benefiting us in these tests Corrected spelling of "respects" It's better to use `assert_not_operator` over `assert !r.valid`
* move AR length validation tests into separate test-case.Yves Senn2014-04-241-42/+1
| | | | | Conflicts: activerecord/test/cases/validations/association_validation_test.rb
* Properly repair validations when dynamically addedAkira Matsuda2013-07-291-24/+30
|
* Revert "Merge pull request #4490 from EmmanuelOga/master"José Valim2013-06-041-17/+0
| | | | | | | | This behaviour doesn't actually make sense, the context of the child should not be affected by the parent. See #10492. This reverts commit 5f8274efe128ffeec8fa3179460f5167a078f007, reversing changes made to 81e837e810460d066a2e5fc5a795366ec8ab2313.
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-1/+1
|
* validate related records in the same validation context as parent.Emmanuel Oga2012-01-171-0/+17
| | | | | | | | | | | | | | | | | | | | 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. ```
* 'with_kcode' removed. Arun Agrawal2011-12-211-8/+6
| | | | Testing Sandbox removed.
* Do not validate associated records marked for destructionOlek Janiszewski2011-12-051-0/+10
| | | | | | The main reason for this change is to fix a bug where `validates_associated` would prevent `accepts_nested_attributes_for` with `allow_destroy: true` from destroying invalid associated records.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* removing many unused variablesAaron Patterson2010-11-161-2/+2
|
* Ensure new validates works with uniqueness validator.José Valim2010-01-081-55/+43
|
* Simplify repair_validations on AR and make it work with new callbacks.José Valim2010-01-011-2/+3
|
* Add test to verify that the new :inverse_of association option will indeed ↵Wolfram Arnold2009-08-081-0/+23
| | | | | | | | fix the validation problem for a belongs_to relationship that validates_presence_of the parent, when both the parent and the child are new (in-memory) records. Also check that this works when the parents adds child via nested_attributes_for. Lastly, add a require 'models/pet' to association_validation_test.rb, so that test can be run independently (was failing due to that missing dependency). [#2815 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Deprecate Error#on(attribute) in favour of Errors#[attribute]Pratik Naik2009-03-201-3/+3
|
* Move relevant validation tests from Active Record to Active ModelPratik Naik2009-03-201-0/+101