aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations/associated.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | Mainly around `nil` [ci skip]
* Improve support for non Active Record objects on `validates_associated`Kassio Borges2015-11-081-2/+8
| | | | | | Skipping `marked_for_destruction?` when the associated object does not responds to it make easier to validate virtual associations built on top of Active Model objects and/or serialized objects that implement a `valid?` instance method.
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-1/+2
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* Add a note on custom validation contexts.Justin Weiss2014-08-051-3/+5
| | | | | | | | | The documentation on `:on` for validations was inconsistent, and most only referenced the `:create` and `:update` contexts. I fixed those to be consistent with the documentation on `AM::Validations.validates`, which seemed to have the best docs. [ci skip]
* Revert "Merge pull request #4490 from EmmanuelOga/master"José Valim2013-06-041-1/+1
| | | | | | | | 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.
* documentation fixes for Array.wrap and AR::Validations::AssociatedValidatorHrvoje Šimić2013-04-171-2/+2
|
* update AR::Validations documentation [ci skip]Francesco Rodriguez2012-09-221-1/+1
|
* update AR::Validations::AssociatedValidator documentation [ci skip]Francesco Rodriguez2012-07-291-13/+19
|
* validate related records in the same validation context as parent.Emmanuel Oga2012-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | 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. ```
* Do not validate associated records marked for destructionOlek Janiszewski2011-12-051-2/+3
| | | | | | 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.
* make the warning clear about the effect of using validates_associated on ↵Vijay Dev2011-08-041-9/+1
| | | | both sides on an association.
* Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-2/+2
|
* copy-edits 8d96b89Xavier Noria2011-02-211-1/+3
|
* Clarification of ActiveRecord ActiveModel validation documentationPeer Allan2011-02-181-1/+1
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-2/+2
| | | | 's/[ \t]*$//' -i {} \;)
* ensuring that description does not exceed 100 columnsNeeraj Singh2010-08-021-3/+4
|
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-06-211-1/+1
| | | | | | | | | | | | | | | | hash and make various Validators pass their (filtered) options. This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format". Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation. Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options). Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now. The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet. Signed-off-by: José Valim <jose.valim@gmail.com>
* Ensure new validates works with uniqueness validator.José Valim2010-01-081-2/+1
|
* No need to use ValidationsRepairHelper hack on ActiveModel anymore, ↵José Valim2009-12-231-1/+1
| | | | Model.reset_callbacks(:validate) is enough. However, tests in ActiveRecord are still coupled, so moved ValidationsRepairHelper back there.
* ActiveRecord::Validations are now built on top of Validator as well.José Valim2009-12-231-7/+9
|
* Move validate_on_create and validate_on_update from ActiveModel to ActiveRecordPratik Naik2009-03-211-2/+1
|
* Move uniqueness and association validations to Active RecordPratik Naik2009-03-191-0/+47