views:

83

answers:

1

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!

A: 

I'd like to see a solution to this as well, I've been trying to get uploadify/paperclip to work with rails3. And all the work up hacked together solutions that do seem to be posted haven't worked for me either.

Tarellel
so... here is your answer!:P
http://railsforum.com/viewtopic.php?id=40591