Skip to content

Instantly share code, notes, and snippets.

@aaronjensen
Created October 30, 2012 20:03
Show Gist options
  • Save aaronjensen/3982631 to your computer and use it in GitHub Desktop.
Save aaronjensen/3982631 to your computer and use it in GitHub Desktop.
Force strong parameters
# Place in config/initializers
ActiveRecord::Base.class_eval do
class << self
def inherited_with_strong_params(sub)
inherited_without_strong_params(sub)
# Filter out plugin models that won't work with strong_parameters yet
unless sub.name =~ /^doorkeeper/i
sub.send :include, ActiveModel::ForbiddenAttributesProtection
end
end
alias_method_chain :inherited, :strong_params
end
end
@RichardJordan
Copy link

Thanks. I was just looking how best to do this for exactly this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment