Routing error when including javascript

Hi all -

I'm trying to use a javascript library in my rails app and I'm getting a routing error that I can't seem to fix. I'm using rails 1.2.3, and all restful routing. In my layout file, I have the following line:

<%= javascript_include_tag "external" %>

then in #RAILS_ROOT/public/javascripts I have a file called "external.js".

When I try to load the page in question, I get this error in my log:

ActionController::RoutingError (no route found to match "/javascripts/ external.js" with {:method=>:get}):     /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/routing.rb:1292:in `recognize_path'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/routing.rb:1282:in `recognize'     /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: 40:in `dispatch'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ rails.rb:78:in `process'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ rails.rb:76:in `synchronize'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ rails.rb:76:in `process'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 618:in `process_client'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 617:in `each'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 617:in `process_client'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 736:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 736:in `initialize'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 736:in `new'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 736:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 720:in `initialize'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 720:in `new'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb: 720:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:271:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in `each'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails: 127:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ command.rb:211:in `run'     /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails: 243     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:342:in `new_constants_in'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in `load'     /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ mongrel.rb:60     /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'     /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in `require'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:342:in `new_constants_in'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in `require'     /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/ server.rb:39     /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'     /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'     script/server:3

Is this normal? I guess it makes sense, given that Javascript pulls include files in via HTTP, but I'm a little unsure what the best way to solve this is.

Any tips or suggestions would be greatly appreciated....thanks!

Josh

This looks more like a web server issue than a rails issue. It should not even get to the routing if the web server can find the file.

Check your web server config and make sure the file cases match if you are on a case sensitive server.

Michael

Hi -

Thanks for the quick reply. This is still in development right now, so I'm just using mongrel locally at the moment. I'm a bit new to all this, so I'm not sure where to look next. Do I need to setup a web server in my dev environment to get this error to go away?