Class: Graphiti::Util::Link
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(sideload, model) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(sideload, model) ⇒ Link
Returns a new instance of Link.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/graphiti/util/link.rb', line 4 def initialize(sideload, model) @sideload = sideload @model = model @linkable = true if @sideload.type == :polymorphic_belongs_to if (type = @model.send(@sideload.grouper.field_name)) @sideload = @sideload.children.values.find { |c| c.group_name == type.to_sym } @polymorphic_sideload_not_found = true unless @sideload else @linkable = false end end end |
Instance Method Details
#generate ⇒ Object
21 22 23 24 25 |
# File 'lib/graphiti/util/link.rb', line 21 def generate if linkable? on_demand_links(raw_url) end end |