Class: MagicAttribute
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MagicAttribute
- Defined in:
- lib/app/models/magic_attribute.rb
Overview
Always work through the interface MagicAttribute.value
Instance Method Summary collapse
Instance Method Details
#to_s ⇒ Object
8 9 10 |
# File 'lib/app/models/magic_attribute.rb', line 8 def to_s (magic_option) ? magic_option.value : value end |
#update_magic ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/app/models/magic_attribute.rb', line 12 def update_magic if option = find_magic_option_for(value) unless magic_option and magic_option == option self.value = nil self.magic_option = option end elsif magic_column.allow_other self.magic_option = nil end end |