Max Williams wrote:Strange, i'm using rails 2.3.4 and just tried commenting all my routes except the ones you list and it's fine. What does
rake routes
give you?
Processing ApplicationController#index (for 127.0.0.1 at 2010-11-08 19:34:21) [GET]
ActionController::RoutingError (No route matches "/" with {:method=>:get}):
/usr/lib/ruby/1.8/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
/usr/lib/ruby/1.8/action_controller/routing/route_set.rb:441:in `recognize'
/usr/lib/ruby/1.8/action_controller/routing/route_set.rb:436:in `call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:121:in `_call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:130:in `build_middleware_stack'
/usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
/usr/lib/ruby/1.8/active_record/query_cache.rb:29:in `call'
/usr/lib/ruby/1.8/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/usr/lib/ruby/1.8/active_record/query_cache.rb:9:in `cache'
/usr/lib/ruby/1.8/active_record/query_cache.rb:28:in `call'
/usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/usr/lib/ruby/1.8/action_controller/string_coercion.rb:25:in `call'
/usr/lib/ruby/1.8/rack/head.rb:9:in `call'
/usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/1.8/action_controller/params_parser.rb:15:in `call'
/usr/lib/ruby/1.8/action_controller/session/cookie_store.rb:93:in `call'
/usr/lib/ruby/1.8/action_controller/failsafe.rb:26:in `call'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize'
/usr/lib/ruby/1.8/rack/lock.rb:11:in `call'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:114:in `call'
/usr/lib/ruby/1.8/action_controller/reloader.rb:34:in `run'
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:108:in `call'
/usr/lib/ruby/1.8/rack/urlmap.rb:47:in `call'
/usr/lib/ruby/1.8/rack/urlmap.rb:41:in `each'
/usr/lib/ruby/1.8/rack/urlmap.rb:41:in `call'
/usr/lib/ruby/1.8/rack/content_length.rb:13:in `call'
/usr/lib/ruby/1.8/rack/handler/webrick.rb:48:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/1.8/rack/handler/webrick.rb:14:in `run'
Rendering rescues/layout (not_found)
Then I have changed the code from routes.rb to ( I have read that defining the root at the bootom is right ):
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
root :to => 'demo#index'
... but I get the same result.
I should add that I'm running my code under var/www, on an apache server, and I have tried to config apache with rails without success, I get "Ruby on Rails application could not be started......Error message: No such file or directory - config/environment.rb"
Maybe some apache config is disturbing WEBrick ?
This is my demo controller:
class DemoController < ApplicationController
def index
end
end