aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Integer#even? and Integer#odd? are not needed for Ruby >= 1.8.7Xavier Noria2009-11-091-2/+0
|
* Move validator, human_name and human_attribute_name to ActiveModel, remove ↵José Valim2009-10-201-89/+0
| | | | | | deprecated error messages and add i18n_scope and lookup_ancestors. Signed-off-by: Carl Lerche <carllerche@mac.com>
* Callbacks, DeprecatedCallbacks = NewCallbacks, CallbacksJoshua Peek2009-10-121-7/+7
|
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-30/+5
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* allow ActiveRecord#RecordInvalid exception message to be localizedSven Fuchs2009-08-261-1/+2
| | | | | | [#2754 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Merge docrailsPratik Naik2009-07-251-1/+1
|
* Simplify AMo validation attribute readerJoshua Peek2009-06-171-4/+0
|
* Update for Active Model yielding per error not per attributeJeremy Kemper2009-06-081-0/+1
|
* AS::Concern redefines "include" to lazy include modules as dependenciesJoshua Peek2009-05-291-2/+2
|