lib/jt-rails-enum.rb in jt-rails-enum-1.0.3 vs lib/jt-rails-enum.rb in jt-rails-enum-1.1.0
- old
+ new
@@ -23,9 +23,10 @@
define_method("#{value_method_name}?") { self[field] == i }
define_method("#{value_method_name}!") { update! field => i }
klass.scope value_method_name, -> { klass.where field => i }
+ klass.scope "#{field}_not_#{value}", -> { klass.where.not(field => i) }
end
validates field, allow_nil: true, inclusion: { in: klass.send(field.to_s.pluralize).values }
end