Skip to content
This repository

option :within in :exclusion validator not recognized #7118

Closed
acesuares opened this Issue July 20, 2012 · 4 comments

2 participants

Ace Suares Rafael Mendonça França
Ace Suares
validates :name, :exclusion => { :within => %w(a b c) }

ruby-1.9.3-p194@TestApp/gems/activemodel-3.2.3/lib/active_model/validations/exclusion.rb:13:in `check_validity!': An object with the method #include? or a proc or lambda is required, and must be supplied as the :in option of the configuration hash (ArgumentError)

In the docs it says :within is an alias for :in
http://guides.rubyonrails.org/active_record_validations_callbacks.html#exclusion

Ace Suares

Same with :inclusion

Rafael Mendonça França
Owner

Which Rails version? Did :in works fine?

Rafael Mendonça França
Owner

This is a documentation error. :within is not valid anymore. I checked 3.0.x, 3.1.x, 3.2.x

UPDATE: :within is only valid to lenght validator

Rafael Mendonça França
Owner

I'll fix this later

Rafael Mendonça França rafaelfranca closed this issue from a commit July 20, 2012
Rafael Mendonça França `validates_inclusion_of` and `validates_exclusion_of` now accept
`:within` option as alias of `:in` as documented.

Fix #7118
53edd32
Rafael Mendonça França rafaelfranca closed this in 53edd32 July 20, 2012
Rafael Mendonça França rafaelfranca referenced this issue from a commit July 20, 2012
Rafael Mendonça França `validates_inclusion_of` and `validates_exclusion_of` now accept
`:within` option as alias of `:in` as documented.

Fix #7118
089371a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.