Skip to content

Instantly share code, notes, and snippets.

@mrrooijen
Created October 14, 2010 19:32
Show Gist options
  • Save mrrooijen/626860 to your computer and use it in GitHub Desktop.
Save mrrooijen/626860 to your computer and use it in GitHub Desktop.
For if you are using a Flash-based uploader like Uploadify and Rails 3.
## Inside: config/initializers/session_store.rb
Rails.application.config.middleware.insert_before(
ActionDispatch::Session::CookieStore,
FlashSessionCookieMiddleware,
Rails.application.config.session_options[:key]
)
@trevorturk
Copy link

I actually just made a gem for this: http://github.com/trevorturk/flash_cookie_session

I'm doing some shenanigans that I don't like to get the session_options[:key] too, though. The way you're doing it didn't quite work for me. Thanks for posting in any case!

@mrrooijen
Copy link
Author

Ohh! Damn! Who would've thought a gem existed for this! watching

Thanks a million mate! :) I will check it out.

@trevorturk
Copy link

Yeah -- please fork and pull request if you have any improvements. Figuring out how to solve this one fairly common problem takes waaaayyyy too much googling and I think some kind of group effort in the form of a gem would save a lot of hair pulling ;)

@mrrooijen
Copy link
Author

I agree. The thing is that the first Middleware snippet I found on someone's blog worked. Then I opened Internet Explorer (6, 7, 8) all died because it had some issue with the AuthenticityToken. Found another snippet, modified it and that appeared to work. Now you show me this gem and I just pulled my stuff out, added the gem to the Gemfile and voila. All browsers work!

I think this gem of yours will definitely help a lot of people and save them the hassle. It certainly motivates me to use this kind of uploader more in the future! Thanks again!

@pacovell
Copy link

pacovell commented Jan 8, 2011

The gem is a big win, given the number of people doing this and because most of the documentation is still dealing with Rails 2.x. Good work, just need to find more ways to get the word out so nobody else has to mess with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment