Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Fixing form_authenticity_token in the test environment

#242

In trunk (and 2.0x) using form_authenticity_token in a template will result in an error because protect_from_forgery is disabled.

In the rare ocasion of having to manually build a form and add the token tests will raise an exception. This patch (which includes a test) fixes it.

The problem is also described here:

http://groups.google.com/group/r...

The "fix" is merely outputting a blank string instead of the token if protect_from_forgery is disabled and form_authencity_token is invoked.

Reported by Tiago Macedo · May 23rd, 2008 @ 04:32 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • Title changed from [PATCH] Fixing form_authenticity_token in the test environment to Fixing form_authenticity_token in the test environment

    May 23rd, 2008 @ 04:35 PM

  2. Pratik
    Pratik
    • State changed from new to invalid

    This patch feels like a hack. You should just be using mocking/stubbing for such cases.

    Thanks.

    May 29th, 2008 @ 10:50 AM