Sha256: d8894950388a76040040c1f2d0581d051afadd847151d279f27f3dfff60038b8

Contents?: true

Size: 481 Bytes

Versions: 7

Compression:

Stored size: 481 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 mark_as_unread
      self.update_attribute(:is_unread, true)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
commontator-0.5.14 app/models/commontator/subscription.rb
commontator-0.5.13 app/models/commontator/subscription.rb
commontator-0.5.12 app/models/commontator/subscription.rb
commontator-0.4.1 app/models/commontator/subscription.rb
commontator-0.3.10 app/models/commontator/subscription.rb
commontator-0.2.4 app/models/commontator/subscription.rb
commontator-0.2.0 app/models/commontator/subscription.rb