Files
grecia/app/models/widget/card.rb
Javi Martín 574bd87b08 Remove unused (and flaky) card code and its spec
This code was introduced in commit 722a431b, but it stopped being used
in commit 7657a0e0.

The spec was failing sometimes because the method didn't order the
records, but the spec checked the records returned in a certain order.

Furthermore, the method `page` generated a potential conflict with
kaminari's `page method.
2019-05-10 15:21:58 +02:00

22 lines
585 B
Ruby

class Widget::Card < ApplicationRecord
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
end