Sha256: a0fb72bccdce8d71a68dfdf756c0481e82b360c1932447febf9e3656de15b030

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

module RailsSettings
  # In Rails 3, attributes can be protected by `attr_accessible` and `attr_protected`
  # In Rails 4, attributes can be protected by using the gem `protected_attributes`
  # In Rails 5, protecting attributes is obsolete (there are `StrongParameters` only)
  def self.can_protect_attributes?
    (ActiveRecord::VERSION::MAJOR == 3) || defined?(ProtectedAttributes)
  end
end

require 'rails-settings/setting_object'
require 'rails-settings/configuration'
require 'rails-settings/base'
require 'rails-settings/scopes'

ActiveRecord::Base.class_eval do
  def self.has_settings(*args, &block)
    RailsSettings::Configuration.new(*args.unshift(self), &block)

    include RailsSettings::Base
    extend RailsSettings::Scopes
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ledermann-rails-settings-2.4.3 lib/rails-settings.rb
ledermann-rails-settings-2.4.2 lib/rails-settings.rb