This project is archived and is in readonly mode.

#4700 ✓resolved
David Chelimsky

undefined method `protect_against_forgery?' for #<ActionView::Base:0x10ad1a500>

Reported by David Chelimsky | May 26th, 2010 @ 07:08 AM

In a test for the new.html.erb template generated in the scaffold generator, rendering the template results in undefined method 'protect_against_forgery?'.

This is happening because new.html.erb renders _form.html.erb, which calls form_for, which calls FormTagHelper#extra_tags_for_form, which calls protect_from_forgery?, which is not defined in the scope in which it is being called.

I've got a patch that fixes this:
http://github.com/dchelimsky/rails/commit/53ba21a30fd359744cdee9acd...

Admittedly this is not perfect, but it does solve this problem without bleeding into other areas of the system.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>