Class: AttrJson::Associations::Loader::HasCollection
- Defined in:
- lib/attr_json/associations/loader/has_collection.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from AttrJson::Associations::Loader::Base
Instance Method Details
#load ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/attr_json/associations/loader/has_collection.rb', line 8 def load value = @record.public_send(@assoc.primary_key) if value.present? @assoc.scoped.merge(target_scope(@assoc.foreign_key, value)) .merge(target_order(@assoc.foreign_key, value)) else @assoc.klass.none end end |