开发者

Access Rails ActiveRecord db in production mode

I've just deployed my first app to production. It's a simple front end for managing a DB, and the real action for the app happens in a script I placed in app/ called validation_script.rb. It accesses elements in the DB using ActiveRecord and performs actions based on their values. When I was developing, I would test the script by:

rails runner app/validation_script.rb

This ran without any problems on my local machine. But now that I have pushed this onto the hosting server and into production mode, running that same command on the server doesn't access the elements in the ActiveRecord DB. I set my environment in environment.r开发者_JAVA技巧b to ENV['RAILS_ENV'] ||= 'production'. Are there any other settings I'm missing in order to connect to the production DB?


Try this:

rails runner -e production app/validation_script.rb
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜