Sha256: 5576202b665d36beeaddd541a6e672d45ea85d37bbfa6b9b95790a390cff0e0d
Contents?: true
Size: 943 Bytes
Versions: 5
Compression:
Stored size: 943 Bytes
Contents
module Effective class Post < ActiveRecord::Base acts_as_role_restricted if defined?(EffectiveRoles) acts_as_regionable if defined?(EffectiveRegions) self.table_name = EffectivePosts.posts_table_name.to_s belongs_to :user structure do title :string, :validates => [:presence] category :string, :validates => [:presence] published_at :datetime, :validates => [:presence] draft :boolean, :default => false tags :text roles_mask :integer, :default => 0 timestamps end scope :drafts, -> { where(:draft => true) } scope :published, -> { where(:draft => false).where("#{EffectivePosts.posts_table_name}.published_at < ?", Time.zone.now) } scope :with_category, proc { |category| where(:category => category.to_s.downcase) } def to_param "#{id}-#{title.parameterize}" end end end
Version data entries
5 entries across 5 versions & 1 rubygems