Sha256: 6b0ad7702f9a3aef2d188673aa4378b7ad4c7b1235608a1018fa8e28e346fcbe

Contents?: true

Size: 473 Bytes

Versions: 11

Compression:

Stored size: 473 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(:unread, 0)
    end

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
commontator-1.1.3 app/models/commontator/subscription.rb
commontator-1.1.2 app/models/commontator/subscription.rb
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