Sha256: ecebe2a3b62c6131ee616b56ec1173a3d936808ab458a4e04841110e0193813f

Contents?: true

Size: 483 Bytes

Versions: 5

Compression:

Stored size: 483 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

5 entries across 5 versions & 1 rubygems

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