Sha256: e568d398321d110364d50a640bc60a31dc501d733bc5cb581072b376fcc4bb5c
Contents?: true
Size: 533 Bytes
Versions: 22
Compression:
Stored size: 533 Bytes
Contents
require 'reviewed/page' require 'reviewed/product' require 'reviewed/attachment' require 'reviewed/deal' module Reviewed class Article < Base has_attachments has_many :pages has_many :products has_many :deals has_many :related_articles, class_name: "Reviewed::Article" def find_page(slug) pages.find { |page| page.slug.match(/#{slug}/i) } end def primary_product if respond_to?(:products) products.select { |p| p.id == primary_product_id }.first end end end end
Version data entries
22 entries across 22 versions & 1 rubygems