Sha256: 50c2e7afae5c2e25fa451ab98d9e0e33cdee69bd6030eeb4211f5182aec01937

Contents?: true

Size: 534 Bytes

Versions: 13

Compression:

Stored size: 534 Bytes

Contents

module Notifiable
  class NotificationStatus < ActiveRecord::Base
    
    belongs_to :notification, :class_name => 'Notifiable::Notification'
    validates :notification, presence: true
    
    belongs_to :device_token, :class_name => 'Notifiable::DeviceToken'
    validates :device_token, presence: true
    
    self.table_name = 'notifiable_statuses'
    
    def opened!
      update_attribute(:status, -1)
       self.notification.increment!(:opened_count)
    end
    
    def opened?
      self.status == -1
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
notifiable-rails-0.30.4 lib/notifiable/notification_status.rb
notifiable-rails-0.30.3 lib/notifiable/notification_status.rb
notifiable-rails-0.30.2 lib/notifiable/notification_status.rb
notifiable-rails-0.30.1 lib/notifiable/notification_status.rb
notifiable-rails-0.30.0 lib/notifiable/notification_status.rb
notifiable-rails-0.29.0 lib/notifiable/notification_status.rb
notifiable-rails-0.28.1 lib/notifiable/notification_status.rb
notifiable-rails-0.28.0 lib/notifiable/notification_status.rb
notifiable-rails-0.27.1 lib/notifiable/notification_status.rb
notifiable-rails-0.27.0 lib/notifiable/notification_status.rb
notifiable-rails-0.26.3 lib/notifiable/notification_status.rb
notifiable-rails-0.26.1 lib/notifiable/notification_status.rb
notifiable-rails-0.26.0 lib/notifiable/notification_status.rb