Sha256: 316f491f397f5a5c6e43f69fc52fcfa33b8e1eba029b3198a6f81530a4396620
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 Bytes
Contents
class NewsPost < ActiveRecord::Base scope :published, -> { where(draft: false) } default_scope { order('news_posts.start_date DESC') } belongs_to :user belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id', validate: true validates_presence_of :title, :body, :user_id validates_associated :user acts_as_list searchable do text :title, :body time :start_date, :end_date end def self.per_page 10 end end # == Schema Information # # Table name: news_posts # # id :integer not null, primary key # title :text # body :text # user_id :integer # start_date :datetime # end_date :datetime # required_role_id :integer default(1), not null # note :text # position :integer # draft :boolean default(FALSE), not null # created_at :datetime # updated_at :datetime # url :string #
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
enju_news-0.1.1 | app/models/news_post.rb |
enju_news-0.1.0 | app/models/news_post.rb |
enju_news-0.1.0.pre9 | app/models/news_post.rb |