when I tried to run a command line script (let’s say ‘my_script’ here), the same error happened. The reasons were:
- There is only production environment there.
- I missed to set RAILS_ENV for the command line.
So, the following is the solution in my case:
$ RAILS_ENV=production my_script