Class: Lookup
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Lookup
- Defined in:
- app/models/lookup.rb
Instance Method Summary collapse
Instance Method Details
#select_options ⇒ Object
24 25 26 |
# File 'app/models/lookup.rb', line 24 def .map { |key, value| [value, key] } end |
#value_options ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/lookup.rb', line 10 def attr_value = read_attribute(:value_options) if attr_value.present? ActiveSupport::JSON.decode(attr_value).with_indifferent_access else {} end end |
#value_options=(value) ⇒ Object
20 21 22 |
# File 'app/models/lookup.rb', line 20 def (value) write_attribute(:value_options, ActiveSupport::JSON.encode(value).to_s) if value.present? end |