Sha256: aaff03ab55058ad797a6b00b20944c1c0ae618b64dc5214567a9e09030abe2c4

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

class Wupee::Notification < ActiveRecord::Base
  belongs_to :receiver, polymorphic: true
  belongs_to :attached_object, polymorphic: true
  belongs_to :notification_type, class_name: "Wupee::NotificationType"

  validates_presence_of :receiver,
                        :notification_type

  scope :unread, -> { where(is_read: false) }
  scope :ordered, -> { order(created_at: :desc) }

  def mark_as_read
    update_columns(is_read: true)
  end

  def mark_as_sent
    update_columns(is_sent: true)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wupee-1.1.4 app/models/wupee/notification.rb
wupee-1.1.3 app/models/wupee/notification.rb
wupee-1.1.2 app/models/wupee/notification.rb
wupee-1.0.4 app/models/wupee/notification.rb
wupee-1.0.3 app/models/wupee/notification.rb
wupee-1.0.2 app/models/wupee/notification.rb