将Rails置于现有数据库之上 [英] Putting Rails over top of an existing database
本文介绍了将Rails置于现有数据库之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用PHP/MySQL(具体来说是symfony)编写的应用程序,(可能)想在Rails中重写.我知道如何为尚不存在的表创建脚手架,但是如何让Rails读取现有的表结构并基于该结构创建脚手架?
I have an application written in PHP/MySQL (symfony, to be specific) that I'd (potentially) like to rewrite in Rails. I know how to create scaffolding for tables that don't exist yet, but how do I get Rails to read my existing table structure and create scaffolding based on that?
更新:事实证明,我可以运行以下命令来让Rails为我生成模型:
Update: it turns out I can run the following command to get Rails to generate models for me:
rails generate scaffold Bank --no-migration
但是它没有给我表格.我希望能给我表格的东西.
But it doesn't give me forms. I would prefer something that gives me forms.
推荐答案
答案是db:schema:dump
.
http://guides.rubyonrails.org/migrations.html
这篇关于将Rails置于现有数据库之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文