1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

26 commits

Author SHA1 Message Date
Rafael Mendonça França
78fd14c8de Revert the change at ActiveModel::Errors#add_on_blank and fix in the
right place.

The EachValidator#validate already handle :allow_blank and :allow_nil,
correctly.

Closes #8622.

Fix #8621.
2012-12-26 18:55:47 -03:00
Francesco Rodriguez
9ac095fef5 minor edits and remove mixed titles in AM::Validations docs [ci skip] 2012-10-25 20:41:35 -05:00
Francesco Rodriguez
c9a88a2c26 minor edits in AM documentation [ci skip] 2012-10-21 01:26:01 -05:00
Xavier Noria
8f58d6e507 load active_support/core_ext/object/blank in active_support/rails 2012-08-02 21:59:22 +02:00
Bogdan Gusiev
c175563b88 AM::Validations: remove documentation duplicates 2012-07-10 10:07:38 +03:00
Francesco Rodriguez
68df230255 update ActiveModel::Validations::HelperMethods documentation [ci skip] 2012-07-05 00:09:29 -05:00
Francesco Rodriguez
65362af7a8 add :nodoc: to internal implementations [ci skip] 2012-06-25 12:14:50 -05:00
Francesco Rodriguez
3004bc2470 fixing removed empty lines and examples 2012-05-16 10:01:43 -05:00
Francesco Rodriguez
95e14d1523 better format and fixes to validators docs 2012-05-16 01:23:46 -05:00
Alexey Vakhov
448df2d100 Cosmetic fixes in AM validatations docs 2011-11-27 10:23:40 +04:00
Bogdan Gusiev
8620bf90c5 Implemented strict validation concept
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
2011-08-17 17:26:00 +03:00
Xavier Noria
b481574a33 copy-edits 8d96b89 2011-02-21 11:37:08 +01:00
Peer Allan
8d96b89110 Clarification of ActiveRecord ActiveModel validation documentation 2011-02-18 20:51:56 -06:00
Jeroen van Dijk
26392c4ac5 Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options 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>
2010-06-21 11:55:21 +02:00
Rizwan Reza
3ae67fbebb Add titles to the rest of the files in active_model/validations/* 2010-06-15 22:20:19 +04:30
José Valim
d6cbb27e7b Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an 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 bc1c8d58ec.
2010-05-15 21:55:16 +02:00
Jeroen van Dijk
bc1c8d58ec Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options 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>
2010-05-15 11:17:58 -07:00
Josh Kalderimis
9131a88bb8 validation macros can now be used within an instance 2010-05-13 13:57:37 -07:00
jamie
0a79eb7889 Add validates method as shortcut to setup validators for a given set of 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>
2010-01-07 19:23:59 +01:00
José Valim
f1085f4128 Move validations in ActiveModel to validators, however all validatity checks are still in the class method. 2009-12-23 00:36:51 +01:00
José Valim
4f37b97033 Changed ActiveRecord to use new callbacks and speed up observers by only notifying events that are actually being consumed.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-09-08 10:26:39 -05:00
Joshua Peek
28f36279cd Properly require ActiveModel validation dependencies 2009-06-08 20:32:08 -05:00
Pratik Naik
22ad30ed60 Move validate_on_create and validate_on_update from ActiveModel to ActiveRecord 2009-03-21 01:11:38 +00:00
Pratik Naik
8828b2ca67 Move all the Active Record validations to Active Model 2009-03-19 23:28:59 +00:00
Xavier Noria
64092de257 Improve documentation coverage and markup
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-02 14:45:23 +01:00
David Heinemeier Hansson
87535bd373 Splitting them up first
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9173 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-04-01 00:05:48 +00:00