wuputah/redis-example — Issue #2: Update for Rails 3.1
Author: wuputah
Created: 2011-10-10 22:52:58+00:00
State: open

> So, Application.config.session_store options hash ends up being passed to Redis.Client.new (in my case, on the file: .../redis-2.2.2/lib/redis/client.rb). So, my workaround is to parse the redis uri just the same way as it is done on config/initializers/redis.rb.

> Also, the :expires key seems to end up in a limbo where it can't be neither a Fixnum nor a Time interval. :expire_after actually works and accepts a time interval which in turn is nicer for readability.

> So, the relevant part of my config/initializers/session_store.rb ended up as:

```ruby
redis_uri = URI.parse((ENV["REDISTOGO_URL"] || 'redis://127.0.0.1/') + '0')
redis_options = {:host => redis_uri.host, :port => redis_uri.port, :password => redis_uri.password, :db => redis_uri.path[1..-1]}
MakeThings::Application.config.session_store :redis_session_store, redis_options.merge(:expire_after => 24.hours)
```