Module: ActiveRecord::Mysql::Enum::EnumColumnAdapter
- Defined in:
- lib/active_record/mysql/enum/enum_column_adapter.rb
Class Method Summary collapse
-
.value_to_symbol(value) ⇒ Object
Safely convert the value to a symbol.
Instance Method Summary collapse
-
#type_cast_from_database(value) ⇒ Object
Convert to a symbol.
Class Method Details
.value_to_symbol(value) ⇒ Object
Safely convert the value to a symbol.
36 37 38 39 40 41 42 43 |
# File 'lib/active_record/mysql/enum/enum_column_adapter.rb', line 36 def value_to_symbol(value) case value when Symbol value when String value.to_sym if value.present? end end |
Instance Method Details
#type_cast_from_database(value) ⇒ Object
Convert to a symbol.
26 27 28 29 30 31 32 |
# File 'lib/active_record/mysql/enum/enum_column_adapter.rb', line 26 def type_cast_from_database(value) if type == :enum EnumColumnAdapter.value_to_symbol(value) else super end end |