Sha256: fe0d12df968ba06edd1643563b5db2c907ffc23b72fca05564ae56e888cf532f

Contents?: true

Size: 882 Bytes

Versions: 14

Compression:

Stored size: 882 Bytes

Contents

module AdminModel
  extend ActiveSupport::Concern

  included do
    belongs_to :user
    validates :user, presence: true

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

unless ENV['AN_TEST_DB'] == 'mongodb'
  class Admin < ActiveRecord::Base
    include AdminModel
    default_scope { order(:id) }
  end
else
  require 'mongoid'
  class Admin
    include Mongoid::Document
    include Mongoid::Timestamps
    include GlobalID::Identification

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

    include ActivityNotification::Models
    include AdminModel
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
activity_notification-2.3.3 spec/rails_app/app/models/admin.rb
activity_notification-2.3.2 spec/rails_app/app/models/admin.rb
activity_notification-2.3.1 spec/rails_app/app/models/admin.rb
activity_notification-2.3.0 spec/rails_app/app/models/admin.rb
activity_notification-2.2.4 spec/rails_app/app/models/admin.rb
activity_notification-2.2.3 spec/rails_app/app/models/admin.rb
activity_notification-2.2.2 spec/rails_app/app/models/admin.rb
activity_notification-2.2.1 spec/rails_app/app/models/admin.rb
activity_notification-2.2.0 spec/rails_app/app/models/admin.rb
activity_notification-2.1.4 spec/rails_app/app/models/admin.rb
activity_notification-2.1.3 spec/rails_app/app/models/admin.rb
activity_notification-2.1.2 spec/rails_app/app/models/admin.rb
activity_notification-2.1.1 spec/rails_app/app/models/admin.rb
activity_notification-2.1.0 spec/rails_app/app/models/admin.rb