Sha256: 4cbd2ce7c31b3c5187eac2b7c8861ca43592e20f7f138cae8bf4e8e16c380a2f

Contents?: true

Size: 583 Bytes

Versions: 13

Compression:

Stored size: 583 Bytes

Contents

module Carnival
  class AdminUserNotification < ActiveRecord::Base
    include ActionView::Helpers::UrlHelper
    include Carnival::ModelHelper

    belongs_to :admin_user
    belongs_to :notification

    scope :unread, -> {where('read = ?', false)}

    def message_link
      link_to(self.notification.message, Rails.application.routes.url_helpers.admin_read_admin_user_notification_path(self))
    end

    def mark_as_read_and_get_link
      self.read = true
      self.save
      self.notification.link
    end

    def to_label
      self.notification.title
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
carnival-0.0.59 app/models/carnival/admin_user_notification.rb
carnival-0.0.58 app/models/carnival/admin_user_notification.rb
carnival-0.0.57 app/models/carnival/admin_user_notification.rb
carnival-0.0.56 app/models/carnival/admin_user_notification.rb
carnival-0.0.55 app/models/carnival/admin_user_notification.rb
carnival-0.0.54 app/models/carnival/admin_user_notification.rb
carnival-0.0.53 app/models/carnival/admin_user_notification.rb
carnival-0.0.52 app/models/carnival/admin_user_notification.rb
carnival-0.0.51 app/models/carnival/admin_user_notification.rb
carnival-0.0.50 app/models/carnival/admin_user_notification.rb
carnival-0.0.49 app/models/carnival/admin_user_notification.rb
carnival-0.0.48 app/models/carnival/admin_user_notification.rb
carnival-0.0.47 app/models/carnival/admin_user_notification.rb