DaudiHell DaudiHell - 27 days ago 10x
Ruby Question

accessing Rails Console after deploy to server

I´m having trouble to access the rails console in production.

I used

to deploy the app to a VPS

If I cd to
and run
bundle exec rails c
there I always get the option list for creating new rails project, like
rails new

I've also tried
bundle exec rails console --production
rails console
etc all with the same outcome.

the thing is I must be able to access the console because I have to create an admin user for
active admin

might be worth adding that I'm using Passenger/Capistrano and Nginx on Ubuntu 16

Does anyone know what is going on here? Am I doing something wrong?


After running
RAILS_ENV=production bundle exec rails c
I get this message

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control

You may need to remove bin/ from your .gitignore as well.

When you install a gem whose executable you want to use in your app,
generate it and add it to source control:

bundle binstubs some-gem-name
git add bin/new-executable

Loading production environment (Rails 4.2.5)

dkp dkp

You are missing executable files of bin folder in Production after Capistrano deployment.

You need to remove bin from set :linked_dirs from your Capistrano deploy.rb in order to avoid symlinking it.

You can again try cap production deploy, it would take all the executable files from bin to Production.

Now, you can access the rails console using:

RAILS_ENV bundle exec rails c