Skip to content
Browse files

Improve error message for memcache session store when dalli isn't loa…

…ded in app
  • Loading branch information...
1 parent f6f4066 commit 9c0ab33c2edf0a20769b32c326b09da17c54ae4e @guilleiguaran 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 9c0ab33

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