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.

authenticity_token option for form_tag

#2988

The patch adds :authenticity_token option to form_tag helper. It's useful when you need to deal with external application uploads (like uploading files to AWS S3). Some might say that it can be solved using allow_forgery_protection in controller, but the situation becomes more complicated when you need to have both: internal and external forms on the same view. The authenticity token might be turned off by passing false, or overridden by passing custom string.

form_tag "http://far.far.away/form", :authenticity_token => false
form_tag "http://far.far.away/form", :authenticity_token => "a_custom_authenticity_token"

It should be used in button_to helper as well (I can add it if you like the solution).

Reported by qoobaa · August 3rd, 2009 @ 03:07 PM

State: resolved
Milestone: 3.1
Assigned to: Piotr Sarnacki Piotr Sarnacki
Importance: Low

Activity

  1. qoobaa
    qoobaa

    I can try to rebase the patch with master if anybody is interested in the feature.

    May 9th, 2010 @ 10:07 PM

  2. Igor Wiedler
    Igor Wiedler

    Just ran into this (creating a paypal form), would be a useful feature for any form that leaves the site.

    December 17th, 2010 @ 11:59 AM

  3. Piotr Sarnacki
    Piotr Sarnacki
    • Milestone set to 3.1
    • Assigned user set to Piotr Sarnacki
    • Importance changed from to Low

    Jakub: Yes, please rebase the patch with master.

    December 17th, 2010 @ 12:35 PM

  4. Igor Wiedler
    Igor Wiedler

    I have rebased it, tested and sent a pull request via GitHub: https://github.com/rails/rails/pull/145

    December 27th, 2010 @ 11:00 PM

  5. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to committed

    January 9th, 2011 @ 11:50 PM

  6. Repository
  7. bingbing