Class: Exo::ResourceDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/presenters/exo/resource_decorator.rb

Instance Method Summary collapse

Instance Method Details

#item_name(slug_id) ⇒ Object



9
10
11
# File 'app/presenters/exo/resource_decorator.rb', line 9

def item_name slug_id
  wrap_item items.find_by(slug_id: slug_id)
end

#itemsObject



5
6
7
# File 'app/presenters/exo/resource_decorator.rb', line 5

def items
  ScopeWraper.new resource.items, self
end

#meta_field_name(name) ⇒ Object



13
14
15
# File 'app/presenters/exo/resource_decorator.rb', line 13

def meta_field_name name
  resource.meta_fields.where(slug_id: name.to_s).first
end

#wrap_item(item) ⇒ Object



17
18
19
# File 'app/presenters/exo/resource_decorator.rb', line 17

def wrap_item item
  ItemDecorator.new item if item
end