Skip to content

Conversation

@scambra
Copy link

@scambra scambra commented Sep 2, 2011

All requests should be get, it was failing due to forgering protection when a post request use render_component

For example using render :active_scaffold in the layout, when a post request fails due to validation errors, render_component fails due to forgery protection, clears your session, and it will logout you for example.

…n when a post request use render_component

For example using render :active_scaffold in the layout, when a post request fails due to validation errors, render_component fails due to forgery protection, clears your session, and it will logout you for example.
@vhochstein
Copy link
Owner

But does nt that change the request completely, I mean a post is nt a get?

@scambra
Copy link
Author

scambra commented Sep 5, 2011

I will explain in more detail: I have a layout with render :activescaffold => :controller, :params => {:action => :new} to show a quick form to create a model. To render a new action the request must be a GET.

In a get request, index for example, it works right. But in a post request, when it renders the layout, render_component tries to render the new action as a post request, then it tries to check forgery protection and it fails.

@mathieujobin
Copy link

I think this make sense...
it's not a real request, the server does not get called, like with JS:remote:true (I think)
instead, it is just calling the code in ruby process.
So if the HTTP_METHOD must be hard-coded to GET

I don't see a problem.

Except that I don't think I needed to make this change, would it be possible to write a test to reproduce the problem?

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