我有一個使用DataMapper的Rails應用程序。我即將將其轉換爲使用ActiveRecord。如果可能的話,我一次只想做一個模型(或一組模型)。我可以讓DataMapper和ActiveRecord在Rails應用程序中使用不同的數據庫適配器嗎?
現在,我甚至無法啓動應用程序,因爲兩個ORM似乎需要不同的適配器。
如果database.yml
指定適配器mysql
,bundler/rubygems_integration.rb
提出:
Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.)
如果指定mysql2
,activesupport/dependencies
提出:
cannot load such file -- dm-mysql2-adapter (LoadError)
我試圖與mysql2
適配器創建ActiveRecord的一個單獨的環境,然後使用我想先轉換的個人模型中的establish_connection
,但該應用程序仍然無法啓動。
有沒有人做過這個成功?
更新:我從來沒有得到他們運行並排側;我剛剛做了一個大規模的替換,其中一切都被打破了一段時間。 :(祝你好運,任何人試圖這樣做。 – 2012-12-13 13:36:51