【发布时间】:2013-10-10 17:07:32
【问题描述】:
我正在使用预先存在的数据库制作应用程序,我设置了 database.yml 以使用该数据库。
database.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
我只想要数据库中的一个表,它称为帐户视图,我尝试为此生成一个包含所有正确字段的脚手架,但它告诉我需要迁移(当我在浏览器中呈现它时),如果我迁移我将无法使用现有数据,这是正确的吗?我如何制作一个将使用现有数据和字段的模型?
感谢您的帮助:)
【问题讨论】:
-
它是来自预先存在的 Rails 应用程序的数据库,还是只是预先存在的数据?
-
它只是预先存在的数据
标签: mysql ruby-on-rails database