Reputation: 3550
I'm writing a jQuery Mobile website to be turned into a PhoneGap/Cordova app. To facilitate this, I created a brand new rails project, and after changing to the 'thin' gem for a webserver, put the entire jQuery Mobile app in the public/myapp folder of the new Rails project.
This all works fine; I can reach my mobile app from localhost:3000/myapp but after a few hours of testing suddenly the Rails app starts throwing 404s all over the place. What is likely to have happened?
This is ONE of the errors I see in the rails server logs:
ActionController::RoutingError (No route matches [GET] "/js/setlocation_address.js"
Basically every single reference in my <head>
tag to a javascript or css file returns with a 404 error.
Upvotes: 0
Views: 939
Reputation: 3550
I think the solution was to put
config.serve_static_assets = true
in the config/environments/production.rb
file but I'm not sure if this solved the issue as it was an intermittent one.
EDIT
Actually it seems the problem was that I would sometimes go to localhost:3000/myapp
and sometimes to localhost:3000/myapp/index.html
.
Although Rails would route me to the same index.html page each time, my browser wouldn't pickup the relative paths correctly, and would try to GET localhost:3000/css/styles.css
instead of localhost:3000/myapp/css/styles.css
.
Upvotes: 1