Files
nairobi/app/models/widget/card.rb
2019-01-29 17:54:02 +01:00

28 lines
702 B
Ruby

class Widget::Card < ActiveRecord::Base
include Imageable
belongs_to :page, class_name: "SiteCustomization::Page", foreign_key: "site_customization_page_id"
# table_name must be set before calls to 'translates'
self.table_name = "widget_cards"
translates :label, touch: true
translates :title, touch: true
translates :description, touch: true
translates :link_text, touch: true
include Globalizable
def self.header
where(header: true)
end
def self.body
where(header: false, site_customization_page_id: nil).order(:created_at)
end
#add widget cards to custom pages
def self.page(page_id)
where(site_customization_page_id: page_id)
end
end