Skip to content
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

Inline controller's permitted_attributes method #465

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

c-lliope
Copy link
Contributor

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 #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.
@carlosramireziii
Copy link
Collaborator

@nickcharlton Take a look at this one. Seems ready to go

@nickcharlton
Copy link
Member

Agreed; going to merge this.

@nickcharlton nickcharlton merged commit 4ba6e31 into master Mar 7, 2017
@nickcharlton nickcharlton deleted the gw-permitted-attrs branch March 7, 2017 10:17
fwolfst pushed a commit to fwolfst/administrate that referenced this pull request Mar 8, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants