Class: Association
- Defined in:
- lib/yodel/models/core/associations/association.rb
Direct Known Subclasses
ManyEmbeddedAssociation, ManyQueryAssociation, ManyStoreAssociation, OneEmbeddedAssociation, OneQueryAssociation, OneStoreAssociation
Constant Summary
Constants inherited from Field
Instance Attribute Summary
Attributes inherited from Field
Instance Method Summary collapse
Methods inherited from Field
#default_input_type, #display?, field_from_type, from_options, #include_in_search_keywords?, #index?, #inherited?, #initialize, #method_missing, #numeric?, #required?, #searchable?, #strip_nil?, #to_json, #to_str, #typecast, #unique?, #untypecast, #validate
Constructor Details
This class inherits a constructor from Field
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Field
Instance Method Details
#from_json(value, record) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/yodel/models/core/associations/association.rb', line 20 def from_json(value, record) store = record.get_raw(name) clear(store, record) process_json_items(value, record, store, :associate) record.get(name) end |
#json_action(action, value, record) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/yodel/models/core/associations/association.rb', line 2 def json_action(action, value, record) store = record.get_raw(name) case action when 'set' clear(store, record) process_json_items(value, record, store, :associate) when 'add' process_json_items(value, record, store, :associate) when 'remove' process_json_items(value, record, store, :unassociate) when 'clear' clear(store, record) end record.changed!(name) end |