开发者

MongoDB and Authlogic, any gotchas? (mongomapper)

开发者 https://www.devze.com 2023-01-09 01:47 出处:网络
Authlogic, by itself, seems to be too active record centric for MongoDB (specifically mongomapper) as per: http://github.com/binarylogic/authlogic/issues#issue/15.

Authlogic, by itself, seems to be too active record centric for MongoDB (specifically mongomapper) as per: http://github.com/binarylogic/authlogic/issues#issue/15.

However, there's an interesting authlogic plugin for mongo that looks pretty awesome, and sim开发者_StackOverflow社区ple.

Has anyone used this, or have any experience/recommendations for an authlogic mongodb implementation?


I went ahead and inplemented it in a spike, changing from restful_authentication to authlogic. The only gotcha I found was needing to add the following code

/app/models/user.rb

class User
  include MongoMapper::Document
  ...

   def self.quoted_table_name
    "users"
  end
end

The quoted_table_name was being requested when creating a new user_session, so I added it and everything was great and happy.

Highly recommend.

UPDATE

Once I started using multiple users, the login features stopped working for me. It would log you in if you use the password of the first user, but nothing else mattered.

I switched to this initializer: https://gist.github.com/444888/e8b28196c4f4452a06b89d566a6a245eae1e9d92, which has been nice. I also recommend looking at Devise, which has this straight out of the box for mongomapper.

0

精彩评论

暂无评论...
验证码 换一张
取 消