I don't see that you've routed anything to the '/' path.
Your route requires the controller to be in the path.
First step would be to uncomment this
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
replacing 'welcome' with the controller you want / to route to and
index.html with the action.
Along those lines, usually there is a public/index.html that should
be displayed.
Hello::Application.routes.draw do
match ':controller(/:action(/:id(.:format)))'
and then all the commented material it comes with and an "end" at the
end of the file.
But when I typehttp://localhost:3000into my browser I get the
following error message:
Routing Error
No route matches "/"
I'm stumped.
The above means that rails can only recognized paths that start with
the name of a controller, optionally followed by an action and id. '/'
clearly doesn't fall into that pattern so you get a routing error. One
way of specifying a default root is by saying
root :to => 'pages#main'
which says that / should be routed to the main action in
PagesController
I'm following the instructions in Beginning Rails 3:
$ rails generate controller salutation
Then I added a Hello method to the controller.
Then I created a hello.html.erb template in app/views/salutation.
So the routes.rb file with this code:
Hello::Application.routes.draw do
match ':controller(/:action(/:id(.:format)))'
end
is supposed to deliver the desired result of "Hello World!".
But I went ahead and changed the routes.rb file to read:
Hello::Application.routes.draw do
root :to => "salutation#hello"
That delivers the Hello World! in the browser, but along with the .erb
code:
> I don't see that you've routed anything to the '/' path.
> Your route requires the controller to be in the path.
> First step would be to uncomment this
> # You can have the root of your site routed with "root"
> # just remember to delete public/index.html.
> # root :to => "welcome#index"
> replacing 'welcome' with the controller you want / to route to and
> index.html with the action.
> Along those lines, usually there is a public/index.html that should
> be displayed.
> Do you have a file in public/html?
I'm following the instructions in Beginning Rails 3:
$ rails generate controller salutation
Then I added a Hello method to the controller.
Then I created a hello.html.erb template in app/views/salutation.
So the routes.rb file with this code:
Hello::Application.routes.draw do
match ':controller(/:action(/:id(.:format)))'
end
is supposed to deliver the desired result of "Hello World!".
But I went ahead and changed the routes.rb file to read:
Hello::Application.routes.draw do
root :to => "salutation#hello"
That delivers the Hello World! in the browser, but along with the .erb
code:
> > I don't see that you've routed anything to the '/' path.
> > Your route requires the controller to be in the path.
> > First step would be to uncomment this
> > # You can have the root of your site routed with "root"
> > # just remember to delete public/index.html.
> > # root :to => "welcome#index"
> > replacing 'welcome' with the controller you want / to route to and
> > index.html with the action.
> > Along those lines, usually there is a public/index.html that should
> > be displayed.
> > Do you have a file in public/html?
> I'm following the instructions in Beginning Rails 3:
> $ rails generate controller salutation
> Then I added a Hello method to the controller.
> Then I created a hello.html.erb template in app/views/salutation.
> So the routes.rb file with this code:
> Hello::Application.routes.draw do
> match ':controller(/:action(/:id(.:format)))'
> end
> is supposed to deliver the desired result of "Hello World!".
> But I went ahead and changed the routes.rb file to read:
> Hello::Application.routes.draw do
> root :to => "salutation#hello"
> That delivers the Hello World! in the browser, but along with the .erb
> code: