aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/errors.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* | Change the deprecation messages to show the preferred way to work withRafael Mendonça França2015-02-201-6/+6
|/ | | | ActiveModel::Errors
* Merge pull request #18996 from morgoth/deprecate-more-errors-methodsYves Senn2015-02-191-0/+16
|\ | | | | | | Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methods
| * Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methodsWojciech Wnętrzak2015-02-191-0/+14
|/ | | | without replacement.
* Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.Wojciech Wnętrzak2015-02-011-9/+28
| | | | They have inconsistent behaviour currently.
* Fixed duplicating ActiveModel::Errors#detailsWojciech Wnętrzak2015-01-241-1/+2
|
* Add ActiveModel::Errors#detailsWojciech Wnętrzak2015-01-201-20/+37
| | | | | | | | | | | | | | | | To be able to return type of validator, one can now call `details` on Errors instance: ```ruby class User < ActiveRecord::Base validates :name, presence: true end ``` ```ruby user = User.new; user.valid?; user.errors.details => {name: [{error: :blank}]} ```
* Fix error messages scope [skip ci]Anton Davydov2015-01-121-2/+2
|
* Fix inaccurate docs in active_model errors [ci skip]Robson Marques2014-12-221-2/+2
| | | | | | | | | | | | | | The default value for the argument `message` in `ActiveModel::Errors#add` has a new behavior since ca99ab2481d44d67bc392d0ec1125ff1439e9f94. Before person.errors.add(:name, nil) # => ["is invalid"] After person.errors.add(:name, nil) # => [nil]
* Add #key? to ActiveModel::ErrorsGarry Shutler2014-10-141-0/+2
| | | | Mirror Ruby's Hash#key?
* Using `each_with_object` instead of `reduce`Attila Domokos2014-08-221-2/+2
| | | | | This way no new object allocation is taking place. Thanks @jeremy for the suggestion!
* Replacing an each with reduceAttila Domokos2014-08-211-4/+2
| | | | | | | | The functionality has not changed, but the code is more elegant by using `reduce` instead of `each`. This way no accumulator needs to be declared, no explicit return is needed.
* Merge pull request #15889 from carnesmedia/model-nameRafael Mendonça França2014-08-171-1/+1
|\ | | | | | | Use #model_name on instances instead of classes
| * Use #model_name on instances instead of classesAmiel Martin2014-06-241-1/+1
| | | | | | | | | | | | This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class. Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
* | [ci skip] Little bit doc code improvement.Santosh Wadghule2014-07-141-1/+1
|/
* Adds explanation of :base attribute to errors.addDavid Underwood2014-03-271-0/+7
| | | [ci skip]
* Fix ActiveModel::Errors#has_key? return valueAdrien Coquio2014-01-221-1/+1
|
* Change all "can not"s to the correct "cannot".T.J. Schuck2014-01-031-20/+20
|
* Fix few typos and improve markup at some levelsRobin Dupret2013-12-241-2/+2
|
* Fix: documentation for ActiveModel::ErrorsRyoji Yoshioka2013-08-051-4/+4
|
* fix typo in ActiveModel::Error docs [ci skip]Steven Yang2013-06-301-1/+1
|
* make default value for `:message` on `AM::Errors` explicit.Yves Senn2013-06-221-4/+2
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-9/+9
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Improve changelog entry for ActiveModel::Errors#full_messages_for [ci skip]Carlos Antonio da Silva2013-03-301-2/+0
| | | | Add a working example of how to use this new method.
* Add a method full_messages_for to the Errors classshock_one2013-03-241-0/+14
|
* Revert the change at ActiveModel::Errors#add_on_blank and fix in theRafael Mendonça França2012-12-261-7/+1
| | | | | | | | | | | right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621.
* Tests and fix for validates_presence of :allow_nil, :allow_blankColin Kelley2012-12-261-1/+7
| | | | | Conflicts: activemodel/lib/active_model/errors.rb
* Remove ActiveModel::Errors#add_on_present method.Rafael Mendonça França2012-12-211-13/+0
| | | | | | | | We don't need to define a new method in ActiveMode::Errors for each validatior. See https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
* Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the ↵Roberto Vasquez Angel2012-12-151-0/+13
| | | | | | absence of attributes. Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
* Replace comments' non-breaking spaces with spacesclaudiob2012-12-041-3/+3
| | | | | | | | | | Sometimes, on Mac OS X, programmers accidentally press Option+Space rather than just Space and don’t see the difference. The problem is that Option+Space writes a non-breaking space (0XA0) rather than a normal space (0x20). This commit removes all the non-breaking spaces inadvertently introduced in the comments of the code.
* use Array() instead flattenVasiliy Ermolovich2012-11-051-2/+2
| | | | | * move ActiveModel::Errors tests to errors_test.rb * add spec coverage for add_on_empty and add_on_blank
* fix output messages - docs [ci skip]Francesco Rodriguez2012-10-221-16/+16
|
* convert comments to 1.9 hash syntaxAvnerCohen2012-10-221-11/+11
|
* minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-211-1/+1
|
* AM::Validation#validates: ability to pass custom exception to `:strict` optionBogdan Gusiev2012-08-061-2/+6
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-08-041-0/+13
|\ | | | | | | | | | | Conflicts: activemodel/lib/active_model/secure_password.rb activerecord/lib/active_record/associations/collection_proxy.rb
| * add example to ActiveModel::StrictValidationFailed [ci skip]Francesco Rodriguez2012-07-281-0/+13
| |
* | load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|/
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-301-60/+131
|\ | | | | | | | | Conflicts: activemodel/lib/active_model/errors.rb
| * fix punctuation in activemodel/errors [ci skip]Francesco Rodriguez2012-06-251-1/+1
| |
| * add description ActiveModel::StrictValidationField [ci skip]Francesco Rodriguez2012-06-231-0/+10
| |
| * update ActiveModel::Errors#include? documentation [ci skip]Francesco Rodriguez2012-06-221-1/+1
| |
| * add documentation and examples to ActiveModel::Errors [ci skip]Francesco Rodriguez2012-06-221-4/+26
| |
| * update ActiveModel::Errors documentation and minor fixes [ci skip]Francesco Rodriguez2012-06-221-60/+99
| |
* | add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-221-1/+1
| |
* | change param name to improve documentationFrancesco Rodriguez2012-06-221-2/+2
|/ | | | | | | | | | | | | | | The keys of the error messages are actually attribute names. It makes the documentation easier to understand: # Returns +true+ if the error messages include an error for the given # +attribute+, +false+ otherwise. # # person.errors.messages # => { :name => ["can not be nil"] } # person.errors.include?(:name) # => true # person.errors.include?(:age) # => false def include?(attribute) (v = messages[attribute]) && v.any? end
* Refactor AMo::ErrorsCarlos Antonio da Silva2012-04-271-7/+7
| | | | | * Use merge!, remove reverse_merge * Use case statement instead of is_a? checks
* Fix confusing example in ActiveModel::ErrorsThibaut Courouble2012-04-171-2/+2
|
* Updated/changed useless tr/gsubsJurriaan Pruis2012-04-031-1/+1
|
* AM::Errors: allow :full_messages parameter for #as_jsonBogdan Gusiev2012-02-201-3/+14
|
* replacing ordered hash to ruby hashprasath2012-02-081-4/+3
|