Rails宝典七十二式:添加自己的Environment

Rails自带了development、test和production三个environments,而我们可以轻松添加自己的environment:
1,修改database.yml
staging:
  adapter: mysql
  database: store_staging
  user: root
  password: 
  host: localhost


2,添加enviromnets/staging.rb
# ...
config.log_level = :debug
# ...


3,创建数据库
mysqladmin create store_staging -u root -p
rake db:migrate RAILS_EVN=staging


4,以staging环境启动Server
script/server -e staging

你可能感兴趣的:(mysql,Rails)