13 lines
354 B
Ruby
13 lines
354 B
Ruby
class Article < ApplicationRecord
|
|
has_many :all_pages
|
|
has_many :published_pages
|
|
|
|
def all_page_articles
|
|
AllPage.where('article_id = ? AND type_of = 3 AND published = 1', self.id).order('updated_at DESC')
|
|
end
|
|
|
|
def published_page_articles
|
|
PublishedPage.where('article_id = ? AND type_of = 3', self.id).order('created_at DESC')
|
|
end
|
|
end
|