简体   繁体   中英

Heroku and Rails 4: Heroku isn't finding my nested folder under assets/javascripts

I'm running an app on Heroku, and just recently upgrade to rails 4. At first the assets weren't loading, but then I added gem 'rails_12factor' to the Gemfile, and that seemed to fix it. However, in one of my files, I have a javascript file specific to that page I need to load. I do it by doing:

= javascript_include_tag "registrations/registrations.js"

which in Rails 3 would find the file under app/assets/javascripts/registrations/registrations.js

It works fine locally - however, on Heroku it doesn't seem to find the file correctly. How would I go about fixing it?

Note: I can't add the file to the main directory where application.js is, since it messes up the page layout of other pages.

Add this to your GEMFILE

group :heroku do
  gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
  gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
end

If that doesn't work, here is my Rails 4 app on Heroku. https://github.com/andey/bestofama . Feel free to browse the config for any differences

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM