Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle whitelist configuration before active_record.set_configs

Add an initializer block that runs before the active_record.set_configs
initializer so that Active Record doesn't blow up trying to set the
whitelist_attributes configuration variable.

Closes #5
commit 89ddff5a0185ccc4ced337359d175ddfeb6efe53 1 parent 2da542e
@pixeltrix pixeltrix authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/protected_attributes/railtie.rb
View
2  lib/protected_attributes/railtie.rb
@@ -3,7 +3,9 @@ class Railtie < ::Rails::Railtie
config.before_configuration do |app|
config.action_controller.permit_all_parameters = true
config.active_record.whitelist_attributes = true if config.respond_to?(:active_record)
+ end
+ initializer "protected_attributes.whitelist_attributes", :before => "active_record.set_configs" do |app|
ActiveSupport.on_load(:active_record) do
if app.config.respond_to?(:active_record) && app.config.active_record.delete(:whitelist_attributes)
attr_accessible(nil)
Please sign in to comment.
Something went wrong with that request. Please try again.