Search code examples
ruby-on-rails-3http-status-code-404production-environment

Rails Production Single JS File Isn't Precompiled?


So I have a file jquery.tmpl.min.js sitting under app/assets/javascripts/ and for whatever reason it's not being found in my production server. After runnings rake assets:precompile it completes without any errors whatsoever. All my other javascript assets get compiled properly and sent to the browser. I don't have any issues on my development server finding this JS file.

I have the following lines in my production.rb file:

config.serve_static_assets = true
config.assets.compile = true
config.assets.precompile += %w( *.js *.css )

Error message:

ActionController::RoutingError (No route matches [GET] "/assets/jquery.tmpl.min.js"):

Edit According to this issue: https://github.com/rails/rails/issues/3596

Using the javascript_include_tag with something like 'jquery.ba-url.min' wont append the .js extension. Originally I had that but have since changed it to include the .js extension. Still no dice however.

Edit 2 I tried adding //= require jquery.tmpl.min.js to my application.js but now when I attempt to precompile my assets it says it can't find the file.

Edit 3 Tried adding //= require_tree and still it isn't found. This is driving me nuts!


Solution

  • Ok, I found the answer. It turns out Edit 2 was the fix that I was looking for. Problem was that I made the edit on development and commited to my production server using github. However I forgot to add the renamed file to the commit so all my commit ended up doing was deleting the file on the production server.