Why can't I use Rails console?

February 6, 2016 3.9k views
Ruby on Rails PostgreSQL

If I switch to the predefined user ‘rails’ and try to run 'rails console’ it gives me this permission error:

/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir’: Permission denied @ dirsmkdir - /run/user/0/spring-1000 (Errno::EACCES)

if I try to log in as root it tells me that it can’t authenticate with the database. I get that; the environment variable is only set for the Rails user.

Am I not missing something or does this seem like a flaw in the design?

1 Answer

i know this is old, but for someone doing a research, you should try running “rails console production” instead of “rails console” only.

  • Passing the environment’s name as a regular argument is deprecated as of Rails 5.2.

    Use rails console -environment production or rails c -e p instead.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!