Sha256: 67aa983125b493eca2299c0a96418f92a5f139557c56f2cf5aea617f3a10be56

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

unless ENV['AN_TEST_DB'] == 'mongodb'
  class Admin < ActiveRecord::Base
    belongs_to :user
    validates :user, presence: true

    acts_as_notification_target email_allowed: false,
      subscription_allowed: true,
      devise_resource: :user,
      current_devise_target: ->(current_user) { current_user.admin },
      printable_name: ->(admin) { "admin (#{admin.user.name})" },
      action_cable_allowed: true, action_cable_with_devise: true
    end
else
  require 'mongoid'
  class Admin
    include Mongoid::Document
    include Mongoid::Timestamps
    include GlobalID::Identification

    belongs_to :user
    validates :user, presence: true

    field :phone_number,   type: String
    field :slack_username, type: String

    include ActivityNotification::Models
    acts_as_notification_target email_allowed: false,
      subscription_allowed: true,
      devise_resource: :user,
      current_devise_target: ->(current_user) { current_user.admin },
      printable_name: ->(admin) { "admin (#{admin.user.name})" },
      action_cable_allowed: true, action_cable_with_devise: true
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activity_notification-2.0.0 spec/rails_app/app/models/admin.rb