Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | fix some typos found in activemodel | Vipul A M | 2013-03-18 | 1 | -2/+2 |
| | |||||
* | Small typos here and there. | Vipul A M | 2013-03-15 | 1 | -2/+2 |
| | |||||
* | Revert "Merge pull request #7826 from sikachu/master-validators-kind" | Rafael Mendonça França | 2012-10-02 | 1 | -8/+0 |
| | | | | | | | | | | | | | | | | This reverts commit 4e9f53f9736544f070e75e516c71137b7eb49a7a, reversing changes made to 6b802cdb4f5b84e1bf49aaeb0e994b3be6028af9. Revert "Don't use tap in this case." This reverts commit 454d820bf0a18fe1db4c55b0145197d70fef1f82. Reason: Is not a good idea to add options to this method since we can do the same thing using method composition. Person.validators_on(:name).select { |v| v.kind == :presence } Also it avoids to change the method again to add more options. | ||||
* | Make `.validators_on` accept `:kind` option | Prem Sichanugrist | 2012-10-02 | 1 | -0/+8 |
| | | | | | This will filter out the validators on a particular attribute based on its kind. | ||||
* | AM::Validation#validates: ability to pass custom exception to `:strict` option | Bogdan Gusiev | 2012-08-06 | 1 | -0/+9 |
| | |||||
* | Don't enable validations when passing false hash values to ActiveModel.validates | Steve Purcell | 2012-05-28 | 1 | -0/+5 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a falsey option value for a validator currently causes that validator to be enabled, just like "true": ActiveModel.validates :foo, :presence => false This is rather counterintuitive, and makes it inconvenient to wrap `validates` in methods which may conditionally enable different validators. As an example, one is currently forced to write: def has_slug(source_field, options={:unique => true}) slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? } before_validation slugger validations = { :presence => true, :slug => true } if options[:unique] validations[:uniqueness] = true end validates :slug, validations end because the following reasonable-looking alternative fails to work as expected: def has_slug(source_field, options={:unique => true}) slugger = Proc.new { |r| r[:slug] = self.class.sluggify(r[source_field]) if r[:slug].blank? } before_validation slugger validates :slug, :presence => true, :slug => true, :uniqueness => options[:unique] end (This commit includes a test, and all activemodel and activerecord tests pass as before.) | ||||
* | Kill whitespaces :scissors: | Carlos Antonio da Silva | 2012-05-15 | 1 | -1/+1 |
| | |||||
* | clean the erros if an object that includes validations errors is duped. ↵ | Angelo Capilleri | 2012-05-13 | 1 | -0/+15 |
| | | | | Fixes #5953 | ||||
* | replacing ordered hash to ruby hash | prasath | 2012-02-08 | 1 | -1/+1 |
| | |||||
* | Generate strict validation error messages with attribute name | Carlos Antonio da Silva | 2012-02-01 | 1 | -3/+12 |
| | |||||
* | Removed unwanted intializer and replaced with ruby default collect method | prasath | 2012-01-27 | 1 | -2/+1 |
| | |||||
* | validates method should not change options argument | dreamfall | 2012-01-17 | 1 | -0/+6 |
| | |||||
* | Implemented strict validation concept | Bogdan Gusiev | 2011-08-17 | 1 | -0/+33 |
| | | | | | | | 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 | ||||
* | :if should not fire on validations when not in context with :on | Aditya Sanghi | 2011-04-29 | 1 | -0/+14 |
| | |||||
* | Find all validators for multiple attributes | Carl Lerche | 2011-02-05 | 1 | -0/+18 |
| | |||||
* | Tests and docs which explain the use of validate with a block and without ↵ | Santiago Pastorino | 2010-12-19 | 1 | -1/+9 |
| | | | | arguments | ||||
* | ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json ↵ | Thilo Utke | 2010-12-01 | 1 | -2/+2 |
| | | | | | | serialization to properly handle multiple errors per attribute [#5615 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Remove deprecations in ActiveModel. | José Valim | 2010-08-29 | 1 | -36/+0 |
| | |||||
* | after_validation should be called irrespective of the result of validation. | Neeraj Singh | 2010-08-20 | 1 | -0/+2 |
| | | | | | | | | I confirmed that this is the behavior on 2.3.x . [5419 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵ | Santiago Pastorino | 2010-08-14 | 1 | -1/+1 |
| | | | | 's/[ \t]*$//' -i {} \;) | ||||
* | ActiveModel::Errors json serialization to work as Rails 3b4 [#5254 ↵ | Alex Le | 2010-08-02 | 1 | -3/+5 |
| | | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Work around the fact the JSON gem was overwriting to_json implementation for ↵ | José Valim | 2010-06-26 | 1 | -6/+15 |
| | | | | | | | all Ruby core classes. This is required because the JSON gem is incompatible with Rails behavior and was not allowing ActiveModel::Errors to be serialized. So we need to ensure Rails implementation is the one triggered. [#4890 state:resolved] | ||||
* | Regression with how base errors messages are added to a model. Works ↵ | Josh Kalderimis | 2010-06-23 | 1 | -3/+18 |
| | | | | | | correctly for both string error messages and symbol translated messages. Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Make use of assert_equal to test equallity between object assert expects and ↵ | Santiago Pastorino | 2010-05-16 | 1 | -1/+1 |
| | | | | | | | | object and a message of error [#4611 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | validation macros can now be used within an instance | Josh Kalderimis | 2010-05-13 | 1 | -0/+13 |
| | |||||
* | removed AR from all AMo tests, including any unneeded files (schema, ↵ | Josh Kalderimis | 2010-05-09 | 1 | -11/+9 |
| | | | | fixtures and test helper) | ||||
* | removed an old unused model in the AMo tests which also removes another AR ↵ | Josh Kalderimis | 2010-05-09 | 1 | -1/+0 |
| | | | | dependency | ||||
* | removed use of AR in AMo tests and removed testing of scopes (:on) in ↵ | Josh Kalderimis | 2010-05-08 | 1 | -32/+34 |
| | | | | individual validation tests and moved them to their own test file | ||||
* | Re-define empty? for errors to check if the values inside the OrderedHash ↵ | Ryan Bigg | 2010-04-10 | 1 | -0/+6 |
| | | | | | | are empty rather than the OrderedHash itself. [#4356 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Add validators reflection so you can do 'Person.validators' and ↵ | Prem Sichanugrist | 2010-02-21 | 1 | -0/+27 |
| | | | | | | 'Person.validators_on(:name)'. Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Adding Proc support to validation messages so that they can become a little ↵ | Samuel Elliott | 2010-01-17 | 1 | -0/+8 |
| | | | | | | more dynamic, allowing for customisations during the request [#3514 status:resolved]. Signed-off-by: José Valim <jose.valim@gmail.com> | ||||
* | Be sure to convert namespaced names to we have 'Parrots name' instead of ↵ | José Valim | 2010-01-02 | 1 | -0/+6 |
| | | | | 'Parrots.name' in error messages. | ||||
* | No need to use ValidationsRepairHelper hack on ActiveModel anymore, ↵ | José Valim | 2009-12-23 | 1 | -2/+3 |
| | | | | Model.reset_callbacks(:validate) is enough. However, tests in ActiveRecord are still coupled, so moved ValidationsRepairHelper back there. | ||||
* | Ensure validation errors to be ordered in declared order | Akira Matsuda | 2009-09-11 | 1 | -0/+16 |
| | | | | | | [#2301 state:committed milestone:2.3.5] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net> | ||||
* | Changed ActiveRecord to use new callbacks and speed up observers by only ↵ | José Valim | 2009-09-08 | 1 | -3/+3 |
| | | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com> | ||||
* | Allow validations to use values from custom readers [#2936 state:resolved] | James Hill | 2009-08-05 | 1 | -0/+14 |
| | | | | Signed-off-by: Joshua Peek <josh@joshpeek.com> | ||||
* | Deprecate Errors#on_base/add_to_base/invalid?/each_full | Pratik Naik | 2009-03-21 | 1 | -6/+18 |
| | |||||
* | Validation tests arent using any fixtures | Pratik Naik | 2009-03-20 | 1 | -2/+0 |
| | |||||
* | Deprecate Error#on(attribute) in favour of Errors#[attribute] | Pratik Naik | 2009-03-20 | 1 | -1/+25 |
| | |||||
* | TestDatabase -> TestsDatabase | Pratik Naik | 2009-03-20 | 1 | -2/+2 |
| | |||||
* | Move relevant validation tests from Active Record to Active Model | Pratik Naik | 2009-03-20 | 1 | -0/+144 |