aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.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.
* [Active Record] require => require_relativeAkira Matsuda2017-10-211-5/+5
| | | | This basically reverts 9d4f79d3d394edb74fa2192e5d9ad7b09ce50c6d
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* [Active Record] require => require_relativeAkira Matsuda2017-07-011-5/+5
|
* Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-2/+2
| | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* Privatize unneededly protected methods in Active RecordAkira Matsuda2016-12-241-4/+4
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* Fix grammar `a` to `an` [ci skip]Ryuta Kamizono2016-02-131-1/+1
|
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-13/+14
| | | | | | | | | | | | | | | | | | | 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
* Merge pull request #21535 from dmitry/feature/validate-multiple-contextsRafael Mendonça França2015-09-081-1/+5
|\ | | | | Validate multiple contexts on `valid?` and `invalid?` at once
| * Validate multiple contexts on `valid?` and `invalid?` at once.Dmitry Polushkin2015-09-071-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: ```ruby class Person include ActiveModel::Validations attr_reader :name, :title validates_presence_of :name, on: :create validates_presence_of :title, on: :update end person = Person.new person.valid?([:create, :update]) # => true person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]} ```
| * Revert "Merge pull request #21069 from ↵Rafael Mendonça França2015-09-071-5/+1
| | | | | | | | | | | | | | | | | | dmitry/feature/validate-multiple-contexts-at-once" This reverts commit 51dd2588433457960cca592d5b5dac6e0537feac, reversing changes made to ecb4e4b21b3222b823fa24d4a0598b1f2f63ecfb. This broke Active Record tests
| * Validate multiple contexts on `valid?` and `invalid?` at once.Dmitry Polushkin2015-07-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: ```ruby class Person include ActiveModel::Validations attr_reader :name, :title validates_presence_of :name, on: :create validates_presence_of :title, on: :update end person = Person.new person.valid?([:create, :update]) # => true person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]} ```
* | Make ActiveRecordException descendants args optionalPavel Pravosud2015-09-071-4/+10
|/ | | | | | This change allows to instantiate all ActiveRecordError descendant execption classes without arguments, which might be useful in testing and is far less surprising than mandatory arguments.
* AR absence validator respects `marked_for_destruction?`. Closes #20449.Yves Senn2015-06-221-0/+1
| | | | Associated objects that were marked for destruction are considered absent.
* Move the `validate!` method to `ActiveModel::Validations`.Lucas Mazza2015-02-201-14/+2
|
* AR specific length validator to respect `marked_for_destruction`.Yves Senn2014-12-301-0/+1
| | | | | | | | Closes #7247. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/owner.rb
* various error classes: added newlines & removed :nodoc: flag from public ↵Recursive Madman2014-11-261-3/+4
| | | | attribute.
* Moved #create! method from Validations to Persistence moduleBogdan Gusiev2014-08-051-15/+0
|
* Add AR::Base#validate! methodBogdan Gusiev2014-06-231-1/+17
| | | | | Acts same as valid? but raises AR::RecordInvalid exception if validation fails
* ActiveRecord/ActiveModel '#validate' alias for 'valid?'Henrik Nyh2014-03-271-0/+4
| | | | | | | | It's unintuitive to call '#valid?' when you want to run validations but don't care about the return value. The alias in ActiveRecord isn't strictly necessary (the ActiveModel alias is still in effect), but it clarifies.
* drop variable assignment in validationsVipul A M2013-03-271-2/+1
|
* Fix syntax error with no US-ASCII charRafael Mendonça França2012-09-281-1/+1
|
* update AR::Validations documentation [ci skip]Francesco Rodriguez2012-09-221-11/+12
|
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-3/+3
|
* AR has a subclass of AM:PresenceValidator.Brent Wheeldon & Nick Monje2012-07-201-0/+1
| | | | | | | This allows us to mark the parent object as invalid if all associated objects in a presence validated association are marked for destruction. See: https://github.com/rails/rails/issues/6812
* Allow translations of activerecord.errors.messages.record_invalid to be ↵Christopher Dell2012-03-051-1/+1
| | | | looked up in errors.messages.record_invalid
* Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-1/+1
|
* updated AR#create! to accept an options hash so the mass-assignment security ↵Josh Kalderimis2011-05-121-3/+3
| | | | role can be passed in, also updated the Changelog to mention the change to some of the AR method signatures.
* Better formatting hereSebastian Martinez2011-04-241-3/+3
|
* copy-edits 8d96b89Xavier Noria2011-02-211-7/+7
|
* Typo: fixing the theNicholas Rowe2011-02-191-1/+1
|
* Clarification of ActiveRecord ActiveModel validation documentationPeer Allan2011-02-181-1/+15
|
* ActiveRecord#save(false) is now deprecated, now it is save(:validate => false)Jaime Iniesta2011-01-181-1/+1
|
* Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584bJosé Valim2010-11-281-1/+1
|
* use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-1/+1
| | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Refactor AR validations a bitCarlos Antonio da Silva2010-09-061-5/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Cleanup deprecation warnings in active recordCarlos Antonio da Silva2010-09-061-12/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Merge remote branch 'rails/master'Xavier Noria2010-06-201-2/+2
|\ | | | | | | | | Conflicts: actionpack/lib/abstract_controller/base.rb
| * moving before_validation and after_validation functionality from ↵Neeraj Singh2010-06-191-2/+2
| | | | | | | | | | | | | | | | ActiveRecord to ActiveModel [#4653 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* | Adds title to the rest of the files in activerecord/libRizwan Reza2010-06-161-0/+3
|/
* Remove undocumented save_without_validation!Pratik Naik2010-05-111-4/+0
|
* Succint save definitionPratik Naik2010-05-111-4/+2
|
* Make sure valid? preceives the context as in ActiveModel API (ht: Carlos ↵José Valim2010-05-101-25/+22
| | | | Antonio)
* eliminate alias_method_chain from ActiveRecordwycats2010-05-091-41/+30
|
* updated AR to work with the AMo model validation changesJosh Kalderimis2010-05-081-1/+5
|
* Drop AR I18n deprecation and simple use errors.messages as fallback.José Valim2010-01-301-2/+2
|
* save(false) is gone, use save(:validate => false) instead.José Valim2010-01-171-1/+11
|
* Errors messages are now moved from :activerecord.errors to simply :errors on ↵José Valim2010-01-071-1/+1
| | | | I18n yml files.
* Get rid of DeprecatedCallbacks in ActiveRecord::Associations and finally ↵José Valim2009-12-301-2/+0
| | | | remove it.