On Saturday, 22 February 2014 15:05:44 UTC-5, Ruby-Forum.com User wrote:
In my View or Console, The MyModel::TYPES gives me the patched hash, But
saving the patched model with the new types failes. With the error “is
not included in the list”
Please help me, As I am not able to figure out what wrong I have done,
And am I missing something.
The validations attribute is kept in sync by the various macros
(validates* and validates itself), but it is NOT the mechanism used to
actually do the validation - that’s handed off to the callbacks stuff
(which also handles :on, :if, and :unless criteria).
But I’d recommend thinking more about what the intent actually is - if
you’re trying to override the list of possible types in a subclass, it
would make more sense to have an explicit validator that asks the
for the correct set of types to be used.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.