Sha256: abdf1395ed49899623f31d4b86f6ccc6b445f685c54d105b835003ae41edc8e8
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 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: Mongoid::VERSION.to_i < 4 ? Boolean : Mongoid::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: '' field :label include RailsAdminSettings::RequireHelpers include RailsAdminSettings::Processing include RailsAdminSettings::Uploads include RailsAdminSettings::Validation def disabled? !enabled end def enabled? enabled end before_save do self.label = self.key unless self.label.present? 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_settings-0.5.5 | app/models/rails_admin_settings/setting.rb |
rails_admin_settings-0.5.4 | app/models/rails_admin_settings/setting.rb |