Class: Graphoid::BelongsTo
- Defined in:
- lib/graphoid/operators/inherited/belongs_to.rb
Instance Attribute Summary
Attributes inherited from Relation
#inverse_name, #klass, #name, #type
Instance Method Summary collapse
Methods inherited from Relation
#belongs?, #create, #embedded?, #initialize, #many?, #many_to_many?, #one?, #relation?, relations_of, #resolve
Constructor Details
This class inherits a constructor from Graphoid::Relation
Instance Method Details
#exec(_, value) ⇒ Object
11 12 13 14 15 |
# File 'lib/graphoid/operators/inherited/belongs_to.rb', line 11 def exec(_, value) ids = Graphoid::Queries::Processor.execute(klass, value).to_a.map(&:id) attribute = Attribute.new(name: "#{name.underscore}_id", type: nil) Graphoid.driver.parse(attribute, ids, 'in') end |