Module: Leafy::Mixin::ActiveRecord::Schema::InstanceMethods
- Defined in:
- lib/leafy/mixin/active_record/schema.rb
Instance Method Summary collapse
- #leafy_fields ⇒ Object
- #leafy_fields=(leafy_schema) ⇒ Object
- #leafy_fields_attributes=(attributes_list) ⇒ Object
Instance Method Details
#leafy_fields ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/leafy/mixin/active_record/schema.rb', line 11 def leafy_fields data = _leafy_data activerecord_json_column? ? ::Leafy::Schema.new(data) : ::Leafy::Schema.load(data.nil? ? "[]" : data) end |
#leafy_fields=(leafy_schema) ⇒ Object
19 20 21 22 23 |
# File 'lib/leafy/mixin/active_record/schema.rb', line 19 def leafy_fields=(leafy_schema) self._leafy_data = activerecord_json_column? ? leafy_schema.serializable_hash : ::Leafy::Schema.dump(leafy_schema) end |
#leafy_fields_attributes=(attributes_list) ⇒ Object
25 26 27 |
# File 'lib/leafy/mixin/active_record/schema.rb', line 25 def leafy_fields_attributes=(attributes_list) self.leafy_fields = ::Leafy::Schema.new(attributes_list) end |