diff options
author | Prem Sichanugrist <s@sikac.hu> | 2012-10-02 21:45:09 -0400 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2012-10-02 22:09:06 -0400 |
commit | 4f9b59dba0fe9d90f53417f0d4f1bc63679d556a (patch) | |
tree | 71490452c6ee41f9fd06ac90b5d4d3c8091c3073 /activemodel/CHANGELOG.md | |
parent | 0a507925cfc54246dc7d329936f60f8f410c38b6 (diff) | |
download | rails-4f9b59dba0fe9d90f53417f0d4f1bc63679d556a.tar.gz rails-4f9b59dba0fe9d90f53417f0d4f1bc63679d556a.tar.bz2 rails-4f9b59dba0fe9d90f53417f0d4f1bc63679d556a.zip |
Make `.validators_on` accept `:kind` option
This will filter out the validators on a particular attribute based on
its kind.
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r-- | activemodel/CHANGELOG.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index 2c966943ee..2a5598e1b2 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -1,5 +1,15 @@ ## Rails 4.0.0 (unreleased) ## +* `ActiveModel::Validators#validators_on` now accepts a `:kind` option which will filter out the + validators on a particular attribute based on its kind. + + Person.validators_on(:name) + # => [#<ActiveModel::Validations::PresenceValidator:0x007fe604914e60 @attributes=[:name], @options={}>, + # #<ActiveModel::Validations::InclusionValidator:0x007fe603bb8780 @attributes=[:age], @options={:in=>0..99}>] + + Person.validators_on(:name, kind: :presence) + # => [#<ActiveModel::Validations::PresenceValidator:0x007fe604914e60 @attributes=[:name], @options={}>] + * Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to protect attributes from mass assignment when non-permitted attributes are passed. |