Sha256: 4643ae2cf3f0707353aa68b9338ca31be80bba1f8bad622aaa079a1248bc1bca

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# coding: utf-8
module RailsAdminSettings
  class Setting
    include ::Mongoid::Document
    include ::Mongoid::Timestamps::Short

    store_in collection: "rails_admin_settings"

    if Object.const_defined?('Mongoid') && Mongoid.const_defined?('Audit')
      include ::Mongoid::Audit::Trackable
      track_history track_create: true, track_destroy: true
    end

    field :enabled, type: Boolean, default: true
    scope :enabled, where(enabled: true)

    field :type, type: String, default: RailsAdminSettings.types.first

    field :key, type: String
    field :raw, type: String, default: ''

    include RailsAdminSettings::RequireHelpers
    include RailsAdminSettings::Processing
    include RailsAdminSettings::Validation

    def disabled?
      !enabled
    end

    def enabled?
      enabled
    end

    index(key: 1)

    if Object.const_defined?('RailsAdmin')
      include RailsAdminSettings::RailsAdminConfig
    else
      puts "[rails_admin_settings] Rails Admin not detected -- put this gem after rails_admin in gemfile"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_admin_settings-0.3.3 app/models/rails_admin_settings/setting.rb
rails_admin_settings-0.3.2 app/models/rails_admin_settings/setting.rb
rails_admin_settings-0.3.1 app/models/rails_admin_settings/setting.rb
rails_admin_settings-0.3.0 app/models/rails_admin_settings/setting.rb