Search code examples
ruby-on-railsrubygitherokuproduction-environment

Rails.env.production? returns true in staging environment


I've got two rails apps deployed on heroku. One in staging - the other in production environment. I have also set up a staging.rb file in my config directory. For deploying to my staging app, I use "git push staging master" but the condition Rails.env.production? still returns true, which I only want in my prod app. What am I missing?


Solution

  • you have to set environment to staging in heroku. So, you have to use this command

    heroku config:set RAILS_ENV=staging