Skip to content
Browse files

Merge pull request #7565 from guilleiguaran/dalli-session-store

Improve error message for memcache session store when dalli isn't loaded
  • Loading branch information...
2 parents c24c885 + 9c0ab33 commit e371c6603541ffeae35d3388f39b853b0d372144 @carlosantoniodasilva carlosantoniodasilva committed Sep 7, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
View
8 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
@@ -1,5 +1,10 @@
require 'action_dispatch/middleware/session/abstract_store'
-require 'rack/session/dalli'
+begin
+ require 'rack/session/dalli'
+rescue LoadError => e
+ $stderr.puts "You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install"
+ raise e
+end
module ActionDispatch
module Session
@@ -9,7 +14,6 @@ class MemCacheStore < Rack::Session::Dalli
include SessionObject
def initialize(app, options = {})
- require 'dalli'
options[:expire_after] ||= options[:expires]
super
end

0 comments on commit e371c66

Please sign in to comment.
Something went wrong with that request. Please try again.