# From http://www.jarrodspillers.com/2010/02/06/trying-to-use-rails-csrf-protection-on-cached-actions-rack-middleware-to-the-rescue/ # Updated for rails 3.1 module ActionView module Helpers module FormTagHelper alias_method :token_tag_rails, :token_tag def token_tag(token) if token == false || !protect_against_forgery? '' else token = form_authenticity_token if token.nil? tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => ApplicationController::TOKEN_PLACEHOLDER) end end end end end