Sha256: 4aa4e7cb2cd19786e169b96f1f5b356afa1091a105565367764f882dd218f9f2

Contents?: true

Size: 480 Bytes

Versions: 9

Compression:

Stored size: 480 Bytes

Contents

module Commontator
  class Subscription < ActiveRecord::Base
    belongs_to :subscriber, :polymorphic => true
    belongs_to :thread

    validates_presence_of :subscriber, :thread
    validates_uniqueness_of :thread_id, :scope => [:subscriber_id, :subscriber_type]
    
    attr_accessible :subscriber, :thread
    
    def mark_as_read
      self.update_attribute(:is_unread, false)
    end

    def add_unread
      self.update_attribute(:unread, unread + 1)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
commontator-1.1.1 app/models/commontator/subscription.rb~
commontator-1.1.0 app/models/commontator/subscription.rb~
commontator-1.0.6 app/models/commontator/subscription.rb~
commontator-1.0.5 app/models/commontator/subscription.rb~
commontator-1.0.4 app/models/commontator/subscription.rb~
commontator-1.0.3 app/models/commontator/subscription.rb~
commontator-1.0.2 app/models/commontator/subscription.rb~
commontator-1.0.1 app/models/commontator/subscription.rb~
commontator-1.0.0 app/models/commontator/subscription.rb~