Is there any way to set up Redis session store with Rails 4? #160

Closed
youroff opened this Issue Jan 11, 2013 · 16 comments

8 participants

@youroff

It doesn't seem to be working in Rails 4 due to version dependencies I guess. Any updates on the way?

@mhoran

If the API hasn't changed too much, this should be easy. However, I haven't investigated compatibility, and there's nothing currently on the radar. We'd of course welcome a pull request that adds support.

@youroff

Well. I just upped the dependency versions for active_support and action_pack locally and It works. But I'm not sure that it's legitimate and reliable way, so I would aware of making a pull request with these changes.

@jodosha
redis-store member

@youroff I haven't investigated yet, but I've seen most of the methods to accept an optional argument options. https://github.com/rails/rails/blob/master/activesupport/lib/active_support/cache.rb#L274

Which kinda sucks because it creates an infinite protocol.

@youroff

Isn't it the same in current stable release? Anyway, I use it only as a session storage. Do you think it's ok?

@jodosha
redis-store member

Yeah, just noticed. I upgrated tests to Rails 3.2.x and they're passing. Another reason why having that option = nil everywhere sucks.

@bricker

For what it's worth, I have been using redis-store with rails 4 successfully for a while now, with no modifications to the actual source. Granted, I'm only using it in very basic ways (pretty much just the cache helper).

Here's what I did:

I forked this repo, and bumped up the the gem dependencies in a few of the gemspecs:

  • redis-actionpack: 'actionpack', '>= 3.2.3'
  • redis-activesupport: 'activesupport', '>= 3.2.3'
  • redis-rack: 'rack', '~> 1.5.2'

The two commits are 7995257 and 99aa42f .

And then, in my Gemfile, I just need to use those forks:

gem 'redis-store', github: "bricker/redis-store"
gem 'redis-actionpack', github: "bricker/redis-store"
gem 'redis-activesupport', github: "bricker/redis-store"
gem 'redis-rack', github: "bricker/redis-store"

Anybody is welcome to use my forks, of course, but I have no intention of maintaining or updating these at all - this is a temporary workaround so that I could get Redis working with Rails 4 beta.

@nathantsoi

Thx @bricker, I've cleaned up the great work everyone has done on these projects to create an updated set of gems for Rails 4. Specifically, I'm using them to serialize Rails 4 sessions into Redis as JSON.

https://github.com/nathantsoi/redis-store-json

@tisba

What's the status on this? 507935e incorporates the change to require 'activesupport in >= 3.2.3'. Simply using master should work just fine (I gave it a shot, no problems so far).

@jodosha any issues that prevents you from making a release?

@jodosha
redis-store member

@tisba @nathantsoi I'm looking for help for close these tickets, and release the gems. Do you wanna contribute?

@nathantsoi

happy to help, not sure what the question is though? as @tisba said, seems like 507935e takes care of the compatibility issue?

@tisba

what @nathantsoi said, not sure what to do about this issue otherwise…

@jodosha
redis-store member

@tisba @nathantsoi that commit only enables Travis CI build to be run against Rails 4, but the production code isn't there yet.

@msokk

Hi,

what's the status of this.
I get "FiberError - can't yield from root fiber:" with Ruby 2.0

@msokk

It's working for me now, as Rails 4 support has been released. Fiber error was caused by websocket-rails.

@jodosha
redis-store member

Released a few days ago. http://rubygems.org/gems/redis-rails

@jodosha jodosha closed this Aug 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment