lib/torque/postgresql/attributes/builder/enum.rb in torque-postgresql-0.2.7 vs lib/torque/postgresql/attributes/builder/enum.rb in torque-postgresql-0.2.8
- old
+ new
@@ -121,11 +121,11 @@
# Create all the methods that represent actions related to the
# attribute value
def all_values
values_methods.each do |val, list|
- klass.singleton_class.module_eval <<-STR, __FILE__, __LINE__ + 1
- def #{list[0]} # def disabled
+ klass.module_eval <<-STR, __FILE__, __LINE__ + 1
+ scope :#{list[0]}, -> do # scope :disabled, -> do
where(#{attribute}: '#{val}') # where(status: 'disabled')
end # end
STR
klass.module_eval <<-STR, __FILE__, __LINE__ + 1
def #{list[1]} # def disabled?