Topic: Unable to load stylesheet

For some reason the public folder inside my Rails app is inaccessible.  I've check the permissions and all that good stuff, but it is still inaccessible.  The welcome page won't load, as well as stylesheets and javascripts.  Any suggestions?

Re: Unable to load stylesheet

"inaccessible" and "won't load" are vague. Could you give us a more detailed explanation?

Re: Unable to load stylesheet

The app loads but the styles in the stylesheet are not applied and none of the javascripts work.  The app is located in a folder whose contents can be viewed on the network through an Apache server.  When I go to look at the contents of the app's root folder I can view all the folders there with the exception of the 'public' folder.  When the .htaccess file is removed from the 'public' directory, it becomes visible, but the problems with stylesheets and javascript persist.

Re: Unable to load stylesheet

I've just had this same problem pop up out of nowhere. My style sheets and javascript aren't being parsed. All the links are fine and everything was working. I haven't touched the application in months. Folder permissions are fine.

I switched everything back into development mode and dug into the logs and it appears that I'm now getting routing errors, for some unknown reason:

ActionController::RoutingError (Recognition failed for "/stylesheets/scaffold.css"):
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:522:in `recognition_failed'
    /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:512:in `recognize!'
    /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'
    dispatch.cgi:10

Any thoughts?

Re: Unable to load stylesheet

Make sure the default .htaccess is in place, which has mod_rewrite rules that tell Apache not to send the /stylesheets, /images etc URLs to Rails for processing. And of course, make sure mod_rewrite is installed and working on your server in the first place, and that the DocumentRoot for your rails app is set to its /public directory, not the root of the app itself smile

Also Kelli, switch to using dispatch.fcgi if your host has FastCGI support wink

vinnie - rails forum admin

Re: Unable to load stylesheet

I checked all of that and it's fine (sorry, should have mentioned) and yeah, I just dropped back to dispatch.cgi when I switched to back into development mode for debugging (dispatch.fcgi can sometimes be buggy in development mode on Site5, or used to be...).

I've got a ticket in to them, maybe they'll have ideas, since it seems to be something on their end has changed.

Re: Unable to load stylesheet

If you haven't changed anything I'd have thought it would be something at site5. I've never seen this problem before on anything I've developed - strange.

Re: Unable to load stylesheet

It sounds similar to this:

http://railsforum.com/viewtopic.php?id=8825

Except, you know... I'm not using mongrel.

Re: Unable to load stylesheet

Kelli wrote:

It sounds similar to this:

http://railsforum.com/viewtopic.php?id=8825

Except, you know... I'm not using mongrel.

The REQUEST_FILENAME RewriteCond line in the default .htaccess file takes care of that in your situation (provided .htaccess is being parsed, mod_rewrite is on etc.). Unfortunately it's not that easy of an issue. I think something is wrong at the host end.

vinnie - rails forum admin

Re: Unable to load stylesheet

Haven't got a response from them yet, but it works again, so I'm assuming it was something on their end. I'll probably find out exactly what shortly.

Re: Unable to load stylesheet

As vin said, it's almost as if parts of the htaccess file are missing - namely some of the rewrite conditions and rules.