Skip to content

Instantly share code, notes, and snippets.

@FluffyCode
Created October 15, 2014 15:14
Show Gist options
  • Save FluffyCode/943d3e596842087f2fec to your computer and use it in GitHub Desktop.
Save FluffyCode/943d3e596842087f2fec to your computer and use it in GitHub Desktop.
CanCan ActiveModel::ForbiddenAttributesError with rails 4
before_filter do
resource = controller_name.singularize.to_sym
method = "#{resource}_params"
params[resource] &&= send(method) if respond_to?(method, true)
end
@FluffyCode
Copy link
Author

Suggestion provided by AntonTrapp:
ryanb/cancan#835

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