How to create a new environment in Ruby on Rails?

后端 未结 4 1093
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 01:45

I\'m trying to create a new environment (build) for using it with hudson.

I\'m doing this because I didn\'t want to mix up my test databases with hudson test databas

4条回答
  •  悲哀的现实
    2020-12-08 02:42

    Assuming you want create the hudson environment.

    1. Create a new environment file in config/environments/hudson.rb. You can start by cloning an existing one, for instance config/environments/test.rb.
    2. Add a new configuration block in config/database.yml for your environment.
    3. Update any other configuration file you might have under the config folder with your new environment, some gems create their own ymls under the config folder.
    4. That's all.

    Now you can start the server

    rails server -e hudson
    

    or run the console

    rails console hudson
    

    And so on.

    If you are using an older version of Rails, the commands are

    ruby script/server -e hudson
    ruby script/console hudson
    

提交回复
热议问题