Displaying 1 result from an estimated 1 matches for "_validators".
Did you mean:
validators
2014 Feb 22
0
Validates inclusion of include fails at plugin.
Hello,
MyModel.rb,
TYPES = { "type1" => 1 , "type2" => 2, "type3" => 3 }.freeze
validates_inclusion_of :my_type, :in => TYPES.keys
---------------------------------------
MyModelPatch.rb,
base.send(:remove_const, :TYPES)
base._validators[:my_type].reject!{ |validator| validator if
validator.is_a? ActiveModel::Validations::InclusionValidator }
TYPES = { "type1" => 1 , "type2" => 2, "type3" => 3,"type4" => 4,
"type5" => 5 }.freeze
base.const_set('TYPES',TYPES)...