大家用过 uploadify 上传文件吗?有没有到报错的情况? WARNING: Can't verify CSRF token authenticity. 但是要是刷新几次就好了,不是从能出现,不知道是那里出问题,求帮助。
ps:已经加了 middleware 等。
flash_session_cookie_middleware.rb
require 'rack/utils'
class FlashSessionCookieMiddleware
def initialize(app, session_key = '_session_id')
@app = app
@session_key = session_key
end
def call(env)
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
req = Rack::Request.new(env)
env['HTTP_COOKIE'] = [ @session_key,
req.params[@session_key] ].join('=').freeze unless req.params[@session_key].nil?
env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".freeze unless req.params['_http_accept'].nil?
end
@app.call(env)
end
end
session_stroe.rb
Rails.application.config.middleware.insert_before(
ActionDispatch::Session::CookieStore,
FlashSessionCookieMiddleware,
Rails.application.config.session_options[:key]
)
application.rb
%w(middleware).each do |dir|
config.autoload_paths << "#{Rails.root.to_s}/app/#{dir}"
end