我有一個包含多個表的數據庫,每個表都包含可能不遵循滑軌命名約定的列。
是否有一種工具可以從這些表格創建ActiveRecord模型,還是需要一個接一個地執行此操作?將滑軌連接到現有的postgres數據庫 - 控制檯和控制器看不到的模型
如果我手動創建一個表的ActiveRecord模型,但是這樣可以嗎? (沒有隱藏DB標識需要在它的上面?)
UPDATE
我已經試過magicmodels但不能有工作(它已經有一段時間,因爲這是最後一次修改)似乎並沒有被
- change the database.yml so it points towards my existing Postresql database
- manually create my models such as:
# app/models/user.rb
class User < ActiveRecord::Base
end
- run the console and tried
User.all
=> I end up with an error saying that contant User was not initialized.
Doesn't the console import the model automatically ? Or is that linked to the fact the configuration I did is not correct ?
魔法工具怎麼知道該怎麼做? – 2012-02-15 17:30:43
也許就像magic_model_generator一樣,這似乎是一個有趣的選項,雖然 – Luc 2012-02-15 17:43:28