app/models/unidom/common/concerns/model_extension.rb in unidom-common-0.4 vs app/models/unidom/common/concerns/model_extension.rb in unidom-common-0.5

- old
+ new

@@ -123,9 +123,23 @@ def to_id(model) model.respond_to?(:id) ? model.id : model end + def notation_column(*names) + names.each do |name| + 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