Question

I'm using a heroku instance for production, and another for staging. I would like my assets to not be compiled on my staging instance for easier team debugging. I see here that I can disable assets compilation by having a manifest.yml file in my project.

My question, is there anyway to have rails include or exclude a file based on the environment I choose?

Was it helpful?

Solution

Use debug settings like in the development config and get rid of all other lines mentioning assets:

# config/environments/staging.rb
config.assets.debug = true

Use the rails_12factor gem so heroku will serve the assets:

# Gemfile
gem 'rails_12factor'

Edit:

On heroku you can set the environment with:

$ heroku config:set --remote staging RACK_ENV=staging RAILS_ENV=staging

Assuming you deploy to multiple environments and called the staging one "staging". Make sure your Procfile which specifies the start command does not specify the environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top