开发者

Is it possible to have ActiveRecord and DataMapper use the same database in the same app?

I'm in the process of replacing ActiveRecord with DataMapper in one of my apps. Since there aren't any authentication solu开发者_运维问答tions that are compatable with DataMapper, I'm thinking that I could use ActiveRecord just for user authentication, and then use DataMapper everywhere else. I'd like to have both ORMs interacting with the same database. Is something like this possible? I'd appreciate any help.


Yes, it is possible to use both on the same database, and even on the same table.

However, when you use them on the same table, you should be aware that the caching mechanisms that are used for loading records may break if you modify a user with Datamapper, and then access it again with ActiveRecord. You may get the cached record, instead of the updated record with the new password, for instance. You can overcome this by using the "force reload" option, or disable caching completely for ActiveRecord.

Finally, I urge you to submit bug reports / feature requests to the authentication solution you want to use to also support DataMapper :-)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜