Class: ActionDispatch::Session::MongoStore
- Inherits:
-
AbstractStore
- Object
- AbstractStore
- ActionDispatch::Session::MongoStore
- Defined in:
- lib/rails_mongo_sessions/mongo_store.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
Returns the value of attribute collection.
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ MongoStore
constructor
A new instance of MongoStore.
Constructor Details
#initialize(app, options = {}) ⇒ MongoStore
Returns a new instance of MongoStore.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rails_mongo_sessions/mongo_store.rb', line 8 def initialize(app, = {}) require 'mongo' unless [:collection] raise "To avoid creating multiple connections to MongoDB, " + "the Mongo Session Store will not create it's own connection" + "to MongoDB - you must pass in a collection with the :collection option" end @collection = [:collection].respond_to?(:call) ? [:collection].call : [:collection] super end |
Instance Attribute Details
#collection ⇒ Object
Returns the value of attribute collection.
6 7 8 |
# File 'lib/rails_mongo_sessions/mongo_store.rb', line 6 def collection @collection end |