Sha256: d843e1327d8f31296888683882efbc4d9baddc1e84893091e7e68342a0eb7658

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

class ArticleStatus < ActiveRecord::Base

  cattr_reader :per_page
  @@per_page = 50

  STATUS_SENT = 1
  STATUS_VIEWED = 2

  WORD_FOR_STATUS = { STATUS_SENT => I18n.t(:article_status_sent_word),
    STATUS_VIEWED => I18n.t(:article_status_viewed_word) }

  attr_accessible :article_id, :user_id, :status
  belongs_to :article
  belongs_to :user
  validates_presence_of :user_id, :message => I18n.t(:user_not_set_validation_error)
  validates_presence_of :article_id, :message => I18n.t(:article_not_set_validation_error)
  validates_presence_of :status, :message => I18n.t(:status_not_set_validation_error)
  validates_uniqueness_of :status, :scope => [:user_id, :article_id],
    :message => I18n.t(:status_user_article_not_unique_validation_error)

  #FIXME: after the creation the solr indices need to be updated by the information about the changed status
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solarsearch-0.0.10 app/models/article_status.rb
solarsearch-0.0.9 app/models/article_status.rb