Class: Reviewed::Article

Inherits:
Base
  • Object
show all
Defined in:
lib/reviewed/article.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #client

Instance Method Summary collapse

Methods inherited from Base

association_name, #created_at, #initialize, #method_missing, #respond_to?, #to_param, to_path, #to_path, #to_s, #updated_at

Methods included from Embeddable

embedded_name, included, #objectify, #objectify_has_many, #objectify_has_one

Constructor Details

This class inherits a constructor from Reviewed::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Reviewed::Base

Instance Method Details

#find_page(slug) ⇒ Object



15
16
17
# File 'lib/reviewed/article.rb', line 15

def find_page(slug)
  pages.find { |page| page.slug.match(/#{slug}/i) }
end

#primary_productObject



19
20
21
22
23
# File 'lib/reviewed/article.rb', line 19

def primary_product
  if respond_to?(:products)
    products.select { |p| p.id == primary_product_id }.first
  end
end