-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'permitted_attributes' method collides with pundit #417
Comments
I ran into this as well, I ended up just overriding
Definitely not ideal. Luckily I only need Pundit on one of my Administrate controllers for now. |
Fixes #417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision.
Fixes #417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision. This narrows the public API a bit, but that's alright. The user can accomplish all of the removed functionality by overriding the parent `resource_params` method.
👍 |
Fixes thoughtbot#417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision. This narrows the public API a bit, but that's alright. The user can accomplish all of the removed functionality by overriding the parent `resource_params` method.
Fixes thoughtbot#417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision. This narrows the public API a bit, but that's alright. The user can accomplish all of the removed functionality by overriding the parent `resource_params` method.
There's a PR for this #465 that will be in review shortly. |
Fixes #417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision. This narrows the public API a bit, but that's alright. The user can accomplish all of the removed functionality by overriding the parent `resource_params` method.
Fixes thoughtbot#417 Problem: If users include the Pundit gem on an Administrate controller, the controller attempts to call the `permitted_attributes` method defined by pundit instedad of the one defined by Administrate. Because these methods take different arguments, this results in an `ArgumentError` for the user. Solution: Inline the `permitted_attributes` method to avoid the method name collision. This narrows the public API a bit, but that's alright. The user can accomplish all of the removed functionality by overriding the parent `resource_params` method.
Thanks @lserman and @jasonswett I have followed your instructions and now have fixed the Administrate Pundit def resource_params
params.require(resource_name).permit(dashboard.permitted_attributes)
end |
if I include Pundit on my Administrate controller, it raises ArgumentError on create / update.
The problem is calling
permitted_attributes
actually calls the method in Pundit.https://github.com/elabs/pundit/blob/master/lib/pundit.rb#L248
What is a better way to avoid this collision rather than monkey-patching on either of gems?
The text was updated successfully, but these errors were encountered: