2.0 #768

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants

ekampp commented Oct 26, 2012

Allows the controller to overwrite resource_params.

This is done to allow the user to have better control of the allowed parameters that gets parsed to the model resource.

In my case I'm running rails 4, and needed to be able to parse a Actioncontroller::Parameters (strong parameters) hash to the resource, instead of a regular one, in order to parse rails 4's sanitizer.

So my resource_params' method looks something like this:

def resource_params
  unless request.get?
    params.require(:user).permit(:email, :name, :password, :password_confirmation)
  end
end

If you have any input, please let me know.

Best regards, Emil

ekampp added some commits Oct 26, 2012

@ekampp ekampp Try resource parameters from controller first
This will try to grab the resource parameters from the controller
before grabbing them directly from the params hash. This allows fine
grained control and integration with strong parameters.
77f8774
@ekampp ekampp Only try the controller's resour parameters if available. d6eeb4c

ollym commented Dec 12, 2012

See #763 ;)

ekampp commented Dec 13, 2012

Right, I didn't see that other one. Closing this one.

ekampp closed this Dec 13, 2012

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