Skip to content
Browse files

Revert "Using autoload to require the different session stores" 66baa11

… Fixes #9
  • Loading branch information...
1 parent bc68d9f commit 724df5a3626c306687f03627f77fe00658eb6ab9 @brianhempel committed Feb 23, 2012
View
6 lib/mongo_session_store-rails3.rb
@@ -31,6 +31,6 @@ def self.collection_name
self.collection_name = "sessions"
end
-autoload :MongoMapperStore, 'mongo_session_store/mongo_mapper_store'
-autoload :MongoidStore, 'mongo_session_store/mongoid_store'
-autoload :MongoStore, 'mongo_session_store/mongo_store'
+require 'mongo_session_store/mongo_mapper_store'
+require 'mongo_session_store/mongoid_store'
+require 'mongo_session_store/mongo_store'
View
32 lib/mongo_session_store/mongo_mapper_store.rb
@@ -1,22 +1,26 @@
-require 'mongo_mapper'
-require 'mongo_session_store/mongo_store_base'
+begin
+ require 'mongo_mapper'
+ require 'mongo_session_store/mongo_store_base'
-module ActionDispatch
- module Session
- class MongoMapperStore < MongoStoreBase
+ module ActionDispatch
+ module Session
+ class MongoMapperStore < MongoStoreBase
- class Session
- include MongoMapper::Document
- set_collection_name MongoSessionStore.collection_name
+ class Session
+ include MongoMapper::Document
+ set_collection_name MongoSessionStore.collection_name
- key :_id, String
- key :data, Binary, :default => Marshal.dump({})
+ key :_id, String
+ key :data, Binary, :default => Marshal.dump({})
- timestamps!
- end
+ timestamps!
+ end
+ end
end
end
-end
-MongoMapperStore = ActionDispatch::Session::MongoMapperStore
+ MongoMapperStore = ActionDispatch::Session::MongoMapperStore
+
+rescue LoadError
+end
View
49 lib/mongo_session_store/mongoid_store.rb
@@ -1,32 +1,35 @@
-require 'mongoid'
-require 'mongo_session_store/mongo_store_base'
+begin
+ require 'mongoid'
+ require 'mongo_session_store/mongo_store_base'
-module ActionDispatch
- module Session
- class MongoidStore < MongoStoreBase
+ module ActionDispatch
+ module Session
+ class MongoidStore < MongoStoreBase
- class Session
- include Mongoid::Document
- include Mongoid::Timestamps
- self.collection_name = MongoSessionStore.collection_name
+ class Session
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ self.collection_name = MongoSessionStore.collection_name
- if respond_to?(:identity)
- # pre-Mongoid 3
- identity :type => String
- else
- field :_id, :type => String
- end
+ if respond_to?(:identity)
+ # pre-Mongoid 3
+ identity :type => String
+ else
+ field :_id, :type => String
+ end
- field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({}))
- end
+ field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({}))
+ end
- private
- def pack(data)
- BSON::Binary.new(Marshal.dump(data))
+ private
+ def pack(data)
+ BSON::Binary.new(Marshal.dump(data))
+ end
end
-
end
end
-end
-MongoidStore = ActionDispatch::Session::MongoidStore
+ MongoidStore = ActionDispatch::Session::MongoidStore
+
+rescue LoadError
+end

0 comments on commit 724df5a

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