After deploying my app on Heroku, I encountered an issue where my scripts and CSS files are not properly linked. While everything works fine locally, the same does not hold true in the production environment.
This is how I am rendering my scripts and CSS in the view:
<%= javascript_include_tag "welcome_page_scripts" %>
<%= stylesheet_link_tag "welcome_page_styles" %>
I have placed these JS/CSS files in the vendor/javascripts or vendor/stylesheets directory.
In my production.rb file:
config.serve_static_assets = false
config.assets.compile = false
I have tried setting either one of them to true, followed by running the command below, but unfortunately, it did not resolve the issue.
rake assets:precompile --trace RAILS_ENV=production
Update 1: (I also noticed that I already have this in my Gemfile). Despite adding 'rails_12factor' gem for production environment, the asset links are still not functioning correctly on Heroku compared to local setup.
gem 'rails_12factor', group: :production
Any guidance on the right approach to fix this would be greatly appreciated. Thank you.