Module: Unidom::Common::Concerns::ModelExtension::ClassMethods
- Defined in:
- app/models/unidom/common/concerns/model_extension.rb
Instance Method Summary collapse
Instance Method Details
#notation_column(*names) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'app/models/unidom/common/concerns/model_extension.rb', line 128 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 |
#to_id(model) ⇒ Object
124 125 126 |
# File 'app/models/unidom/common/concerns/model_extension.rb', line 124 def to_id(model) model.respond_to?(:id) ? model.id : model end |