我使用预先存在的数据库制作应用程序,我设置了 database.yml 以使用该数据库。
数据库.yml
development:
adapter: mysql2
encoding: utf8
# database: ttlem_demo_development
database: ttle
pool: 5
username: root
password:
socket: /tmp/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
database: ttlem_demo_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
database: ttlem_demo_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock
我只想要数据库中的一个表,它称为帐户视图,我尝试为此生成一个包含所有正确字段的脚手架,但它告诉我需要迁移(当我在浏览器中呈现它时),如果我迁移我将无法使用现有数据,这是正确的吗?我如何制作一个将使用现有数据和字段的模型?
谢谢你的帮助 :)