Sha256: e0e5ae66b0888127fe388a88043598694cf33f3c9cdbdce8da05e93f21a5bc02

Contents?: true

Size: 493 Bytes

Versions: 16

Compression:

Stored size: 493 Bytes

Contents

module Carnival
  class AdminUserNotification < ActiveRecord::Base
    include ActionView::Helpers::UrlHelper
    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

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
carnival-0.0.45 app/models/carnival/admin_user_notification.rb
carnival-0.0.44 app/models/carnival/admin_user_notification.rb
carnival-0.0.43 app/models/carnival/admin_user_notification.rb
carnival-0.0.42 app/models/carnival/admin_user_notification.rb
carnival-0.0.41 app/models/carnival/admin_user_notification.rb
carnival-0.0.40 app/models/carnival/admin_user_notification.rb
carnival-0.0.39 app/models/carnival/admin_user_notification.rb
carnival-0.0.38 app/models/carnival/admin_user_notification.rb
carnival-0.0.37 app/models/carnival/admin_user_notification.rb
carnival-0.0.36 app/models/carnival/admin_user_notification.rb
carnival-0.0.35 app/models/carnival/admin_user_notification.rb
carnival-0.0.34 app/models/carnival/admin_user_notification.rb
carnival-0.0.33 app/models/carnival/admin_user_notification.rb
carnival-0.0.26 app/models/carnival/admin_user_notification.rb
carnival-0.0.11 app/models/carnival/admin_user_notification.rb
carnival-0.0.10 app/models/carnival/admin_user_notification.rb