lib/mongoid/enum.rb in mongoid-enum-i18n-0.3.0 vs lib/mongoid/enum.rb in mongoid-enum-i18n-0.3.3

- old
+ new

@@ -63,18 +63,19 @@ write_attribute(field_name, Array(vals).compact.map(&:to_sym)) end end def create_validations(field_name, values, options) - if options[:multiple] && options[:validate] + return unless options[:validate] + if options[:multiple] validates field_name, :'mongoid/enum/validators/multiple' => { in: values.map(&:to_sym), - allow_nil: !options[:required] + allow_blank: !options[:required] } - elsif validate + else validates field_name, inclusion: { in: values }, - allow_nil: !options[:required] + allow_blank: !options[:required] end end def create_i18n_helper(field_name, options) return if options[:i18n].is_a?(FalseClass)