aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/acceptance.rb
Commit message (Collapse)AuthorAgeFilesLines
* Module#{attr,attr_accessor,attr_reader,attr_writer} become public since Ruby 2.5Ryuta Kamizono2018-12-211-2/+2
| | | | https://bugs.ruby-lang.org/issues/14132
* Prevent infinit method_missing loop on attribute methodsRyuta Kamizono2018-12-151-0/+1
| | | | | | | | | | | | If a klass has acceptance validation and then `klass.undefine_attribute_methods` is happened before an attribute method is called, infinit loop is caused on the `method_missing` defined by the `LazilyDefineAttributes`. https://travis-ci.org/rails/rails/jobs/467053984#L1409 To prevent the infinit loop, the `method_missing` should ensure `klass.define_attribute_methods`.
* Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-171-6/+1
|
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-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
|
* change ActiveModel::Validation to ActiveModel::Validations in commentsSen Zhang2017-02-151-1/+1
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-38/+38
|
* applies new string literal convention in activemodel/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Chomp: prefer String#chomp where we can for a clarity boostlvl0nax2016-04-291-5/+1
| | | | | | Closes #24766, #24767 Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* `validates_acceptance_of` shouldn't require a database connectionSean Griffin2015-09-251-4/+51
| | | | | | | | | | | | | The implementation of `attribute_method?` on Active Record requires establishing a database connection and querying the schema. As a general rule, we don't want to require database connections for any class macro, as the class should be able to be loaded without a database (e.g. for things like compiling assets). Instead of eagerly defining these methods, we do it lazily the first time they are accessed via `method_missing`. This should not cause any performance hits, as it will only hit `method_missing` once for the entire class.
* Improve Validation Helpers' documentation comments and testsRadan Skoric2015-06-271-3/+4
|
* allow '1' or true for acceptance validation.mo khan2015-01-101-2/+6
|
* revises references to :allow_(nil|blank) in some docs [ci skip] [Steven Yang ↵Xavier Noria2014-01-261-4/+2
| | | | | | & Xavier Noria] Closes #11247.
* deprecate Validator#setup (to get rid of a respond_to call). validators do ↵Nick Sutterer2013-05-231-1/+3
| | | | their setup in their constructor now.
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-1/+1
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* minor edits and remove mixed titles in AM::Validations docs [ci skip]Francesco Rodriguez2012-10-251-3/+2
|
* minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-211-1/+1
|
* AM::Validations: remove documentation duplicatesBogdan Gusiev2012-07-101-16/+4
|
* update ActiveModel::Validations::HelperMethods documentation [ci skip]Francesco Rodriguez2012-07-051-10/+10
|
* Use default + merge! instead of reverse_mergeCarlos Antonio da Silva2012-06-261-1/+1
| | | | | Since we're not directly requiring the reverse_merge extension, we can avoid another hash creation by using default_hash.merge! instead.
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-251-2/+2
|
* fixing removed empty lines and examplesFrancesco Rodriguez2012-05-161-0/+1
|
* better format and fixes to validators docsFrancesco Rodriguez2012-05-161-3/+2
|
* Implemented strict validation conceptBogdan Gusiev2011-08-171-0/+2
| | | | | | | In order to deliver debug information to dev team instead of display error message to end user Implemented strict validation concept that suppose to define validation that always raise exception when fails
* Remove extra white spaces on ActiveModel docs.Sebastian Martinez2011-05-231-1/+1
|
* copy-edits 8d96b89Xavier Noria2011-02-211-3/+3
|
* Clarification of ActiveRecord ActiveModel validation documentationPeer Allan2011-02-181-1/+1
|
* remove irrelevant commentsNeeraj Singh2010-09-181-2/+0
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-11/+11
| | | | 's/[ \t]*$//' -i {} \;)
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-06-211-2/+2
| | | | | | | | | | | | | | | | 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>
* Minor doc changes to active_model/validations/acceptance.rbRizwan Reza2010-06-151-15/+30
|
* Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an ↵José Valim2010-05-151-1/+1
| | | | | | | | options hash and make various Validators pass their (filtered) options." Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object. This reverts commit bc1c8d58ec45593acba614d1d0fecb49adef08ff.
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-05-151-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). Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again [#4057 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* validation macros can now be used within an instanceJosh Kalderimis2010-05-131-1/+1
|
* Makes validates_acceptance_of to not override database fields [#4460 ↵Santiago Pastorino2010-04-281-2/+4
| | | | | | state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add validates method as shortcut to setup validators for a given set of ↵jamie2010-01-071-12/+8
| | | | | | | | | | | | | | | attributes: class Person < ActiveRecord::Base include MyValidators validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 } validates :email, :presence => true, :email => true end [#3058 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* ActiveRecord::Validations are now built on top of Validator as well.José Valim2009-12-231-2/+5
|
* Move validations in ActiveModel to validators, however all validatity checks ↵José Valim2009-12-231-7/+11
| | | | are still in the class method.
* Properly require ActiveModel validation dependenciesJoshua Peek2009-06-081-2/+2
|
* Move validate_on_create and validate_on_update from ActiveModel to ActiveRecordPratik Naik2009-03-211-1/+1
|
* Move all the Active Record validations to Active ModelPratik Naik2009-03-191-9/+12
|
* Improve documentation coverage and markupXavier Noria2008-05-021-13/+13
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Splitting them up firstDavid Heinemeier Hansson2008-04-011-0/+45
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9173 5ecf4fe2-1ee6-0310-87b1-e25e094e27de