app/models/unidom/common/concerns/model_extension.rb in unidom-common-0.7 vs app/models/unidom/common/concerns/model_extension.rb in unidom-common-0.8
- old
+ new
@@ -154,9 +154,24 @@
end
end
end
end
+ def notation_boolean_column(*names)
+ names.each do |name|
+ name = name.to_s
+ instance_eval do
+ define_method("#{name}?") do
+ notation.try(:[], 'columns').try(:[], name)
+ end
+ define_method("#{name}=") do |value|
+ notation['columns'] ||= {}
+ notation['columns'][name] = value
+ end
+ end
+ end
+ end
+
end
end
end
\ No newline at end of file