Rails console default environment

前端 未结 2 546
醉酒成梦
醉酒成梦 2020-12-31 06:06

On my development machine:

$ bundle exec rails console
Loading development environment (Rails 3.2.3)
1.9.3p194 :001 > Rails.env
 => \"development\"


        
相关标签:
2条回答
  • 2020-12-31 06:22

    RAILS_ENV is a variable like any other which will always default to development

    if you like you can always open up '~/.bash_profile' on the production server and add this:

     alias sc="bundle exec rails console production"
    

    then run source ~/.bash_profile to reload that file for your terminal session and you can just call sc to load up console.

    0 讨论(0)
  • 2020-12-31 06:27

    The rails executable can't know which environment should run on which machine.

    you can put export RAILS_ENV=production in your ~/.bashrc or ~/.bash_profile file of the user you want to start the console with.

    0 讨论(0)
提交回复
热议问题