forked from ryanfitz/mongo_session_store
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Using autoload to require the different session stores
- Loading branch information
Arvid Andersson
committed
Sep 20, 2011
1 parent
f052e0c
commit 66baa11
Showing
3 changed files
with
40 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
begin | ||
require 'mongo_mapper' | ||
require 'mongo_session_store/mongo_store_base' | ||
require 'mongo_mapper' | ||
require 'mongo_session_store/mongo_store_base' | ||
|
||
module ActionDispatch | ||
module Session | ||
class MongoMapperStore < MongoStoreBase | ||
|
||
class Session | ||
include MongoMapper::Document | ||
set_collection_name MongoSessionStore.collection_name | ||
|
||
key :_id, String | ||
key :data, Binary, :default => Marshal.dump({}) | ||
|
||
timestamps! | ||
end | ||
|
||
module ActionDispatch | ||
module Session | ||
class MongoMapperStore < MongoStoreBase | ||
|
||
class Session | ||
include MongoMapper::Document | ||
set_collection_name MongoSessionStore.collection_name | ||
|
||
key :_id, String | ||
key :data, Binary, :default => Marshal.dump({}) | ||
|
||
timestamps! | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
MongoMapperStore = ActionDispatch::Session::MongoMapperStore | ||
|
||
rescue LoadError | ||
end | ||
MongoMapperStore = ActionDispatch::Session::MongoMapperStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
begin | ||
require 'mongoid' | ||
require 'mongo_session_store/mongo_store_base' | ||
require 'mongoid' | ||
require 'mongo_session_store/mongo_store_base' | ||
|
||
module ActionDispatch | ||
module Session | ||
class MongoidStore < MongoStoreBase | ||
|
||
class Session | ||
include Mongoid::Document | ||
include Mongoid::Timestamps | ||
self.collection_name = MongoSessionStore.collection_name | ||
|
||
identity :type => String | ||
module ActionDispatch | ||
module Session | ||
class MongoidStore < MongoStoreBase | ||
|
||
field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({})) | ||
end | ||
class Session | ||
include Mongoid::Document | ||
include Mongoid::Timestamps | ||
self.collection_name = MongoSessionStore.collection_name | ||
|
||
private | ||
def pack(data) | ||
BSON::Binary.new(Marshal.dump(data)) | ||
end | ||
|
||
identity :type => String | ||
|
||
field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({})) | ||
end | ||
|
||
private | ||
def pack(data) | ||
BSON::Binary.new(Marshal.dump(data)) | ||
end | ||
|
||
end | ||
end | ||
|
||
MongoidStore = ActionDispatch::Session::MongoidStore | ||
end | ||
|
||
rescue LoadError | ||
end | ||
MongoidStore = ActionDispatch::Session::MongoidStore |