Hi guys.
I have a swfupload working with paperclip on rails 3 (finally!) I turned off the autehnticitytoken with the following line in my controller: skip_before_filter :verify_authenticity_token, :only => :create
I know am trying to get sessions working (flash doesn't send this)
Of course i googled my ass of but no luck so far.
this is what i have in my view (part of it)
'<%= u session_key_name %>' : encodeURIComponent('<%= u cookies[session_key_name] %>'),
'authenticity_token' : '<%= form_authenticity_token %>',
'gallerie_id' : '<%= params[:gallery_id] %>'
So i send the session key with the post data. I have to "catch" those params with some middleware code.
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
can anybody help me! really stuck now!