是否需要使用 db:migrate 来工作
有必要使用db:migrate吗?
我有现有的数据库,我想为此编写 ROR 类并与数据库同步。
我该怎么做?
Is it necessary to use db:migrate?
I have existing database, i want to write ROR classes for this and synchronize with DB.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你没有。您的类名只需与表名匹配。但是,我要警告您,针对没有 ar 约定的现有数据库使用 Active Record(默认情况下是 Rails Orm)将是一个巨大的痛苦。我建议检查 datamapper,并使用 Rails 3(因为 Rails 3 中的替代 orms 更容易)
You do not. Your class name just has to match the table name. However, I would warn you that working with Active Record (the rails orm by default) against an existing db that doesn't have the ar conventions is going to be a huge pain. I would recommend checking out datamapper, and using rails 3 (since alternative orms in rails 3 is way easier)