Search code examples
ruby-on-railsdeploymentcapistrano3bin

Rails console on a vps returns 'rails new' usage


I deployed my app following this gorails tutorial. I can't seem to run a rails console in the current folder.

This works!

$ RAILS_ENV=production bundle exec rake db:seed

This doesn't

$ RAILS_ENV=production bundle exec rails console

The command above returns the usage of 'rails new'.

Note: I'm trying to run these commands in the current folder.


Solution

  • Try running this in your server:

    RAILS_ENV=production bundle exec rake rails:update:bin
    

    Then try

    RAILS_ENV=production bundle exec rails console
    

    Permanent solution:

    After the first step.

    Copy your bin folder to shared folder.

    Then in your capistrano, set that bin folder in linked_dirs.

    set :linked_dirs, %w{bin log tmp/backup tmp/pids tmp/cache tmp/sockets vendor/bundle}
    

    Then deploy again.

    So then that updated bin folder will be always served from shared folder and you won't need update your bin every time.