mongoid/mongo_session_store

mongo_session_store not working with MongoMapper

AntonTrapp opened this issue · 2 comments

After following the readme for MongoMapper (installing gem, config gems, setting the session_store):

/Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/mongo_session_store-1.1.0/lib/mongo_session_store/mongo_mapper.rb:12:in <class:Session>': undefined methodensure_indexes!' for MongoMapper:Module (NoMethodError)
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/mongo_session_store-1.1.0/lib/mongo_session_store/mongo_mapper.rb:7:in <class:MongoMapperStore>' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/mongo_session_store-1.1.0/lib/mongo_session_store/mongo_mapper.rb:5:inmodule:Session'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/mongo_session_store-1.1.0/lib/mongo_session_store/mongo_mapper.rb:4:in <module:ActionController>' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/mongo_session_store-1.1.0/lib/mongo_session_store/mongo_mapper.rb:3:in<top (required)>'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inblock in require'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in load' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:inblock in load_gems'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:in each' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:307:inload_gems'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:164:in process' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/initializer.rb:113:inrun'
from /Volumes/Development/broler/config/environment.rb:9:in <top (required)>' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in block in require' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in'
from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' from /Users/atrapp/.rvm/gems/ruby-1.9.1-p378/gems/rails-2.3.5/lib/commands/server.rb:84:in<top (required)>'
from script/server:3:in require' from script/server:3:in

'

ruby 1.9.1
rails 2.3.5
mongo 0.18.3
mongo_mapper 0.7.0
mongo_session_store 1.1.0

MongoMapper.ensure_indexes! has been removed from mongo_mapper 0.7.0. I've fixed the issue but please read the README again it has changed a bit.

Wow! That was fast. Updated the gem, checked the readme - working perfect!
For googlers: If someone had the same problem and is getting a

Mongo::InvalidObjectID (illegal ObjectID format)

error -> exit from your browsers (destroy the session cookies) and the error is gone.

Thanks!