Sha256: 930a9c1dee0970f8a798880cd8a965d3fb318a42043c4926aeea8b08b6d41ffb

Contents?: true

Size: 845 Bytes

Versions: 14

Compression:

Stored size: 845 Bytes

Contents

# this is needed for now to make mass assignment security compatible with the translation of globalize3
# Globalize::ActiveRecord::Translation.class_eval do
#   attr_accessible :locale
# end

class Comment < ActiveRecord::Base

  belongs_to :author, class_name: 'User', foreign_key: 'author_id'
  belongs_to :page

  validates_presence_of :page_id, :body

  scope :showable, -> { where('status = ? OR status = ?', 'pending', 'accepted') }
  scope :pending, -> { where('status = ?', 'pending') }
  scope :accepted, -> { where('status = ?', 'accepted') }
  scope :blocked, -> { where('status = ?', 'blocked') }
  scope :for_locale, lambda { |locale| where('locale = ?', locale) }
  scope :by_recent, -> { order('updated_at desc') }
  scope :by_created, -> { order('created_at') }
  scope :by_recently_created, -> { order('created_at desc') }

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tkh_content-0.9.15 app/models/comment.rb
tkh_content-0.9.14 app/models/comment.rb
tkh_content-0.9.13 app/models/comment.rb
tkh_content-0.9.12 app/models/comment.rb
tkh_content-0.9.11 app/models/comment.rb
tkh_content-0.9.10 app/models/comment.rb
tkh_content-0.9.9 app/models/comment.rb
tkh_content-0.9.8 app/models/comment.rb
tkh_content-0.9.7 app/models/comment.rb
tkh_content-0.9.6 app/models/comment.rb
tkh_content-0.9.5 app/models/comment.rb
tkh_content-0.9.4 app/models/comment.rb
tkh_content-0.9.3 app/models/comment.rb
tkh_content-0.9.2 app/models/comment.rb