# Generating a view from a controller

**URL:** <https://www.ruby-forum.com/t/generating-a-view-from-a-controller/172121>\
**Category:** Rails\
**Created:** [July 15, 2009, 6:50am UTC](https://www.ruby-forum.com/t/generating-a-view-from-a-controller/172121 "2009-07-15T06:50:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazy\_canuck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a587f6/32.png) [@crazy\_canuck](https://www.ruby-forum.com/u/crazy_canuck)\
**Post date:** [July 15, 2009, 6:50am UTC](https://www.ruby-forum.com/t/generating-a-view-from-a-controller/172121/1 "2009-07-15T06:50:32Z")

</div>

Hello everyone,

```
My name is Brandon. I have just finished setting up a ruby on

```

Rails server with PostgreSQL. No i am on windows server 2003 R2  
service pack 2.

I can create an app, and seems like create a controller…

ruby script/generate controller hello index

but when i type localhost:3000 all i get is the  
“welcome aboard, your riding Ruby on Rails.”

home screen not my Hello#index page.

any help would be much appreciated, thanks in advance.

---

<div class="post-metadata">

**Author:** ![crazy\_canuck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a587f6/32.png) [@crazy\_canuck](https://www.ruby-forum.com/u/crazy_canuck)\
**Post date:** [July 15, 2009, 10:42pm UTC](https://www.ruby-forum.com/t/generating-a-view-from-a-controller/172121/2 "2009-07-15T22:42:31Z")

</div>

2009/7/15 s.ross [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > Rails server with PostgreSQL. No i am on windows server 2003 R2
> 
> That tells the Rails routing system that the root of your application  
> (where someone goes if they go to ‘/’) should be to the default action  
> in the HellosController. If your controller is really called  
> HelloController, then:
> 
> map.root :controller =\> “hello”

It might well be worth while having a look at the Ruby on Rails guides  
at [http://guides.rubyonrails.org/](http://guides.rubyonrails.org/), particularly Getting Started with  
Rails.

Colin.

---

<div class="post-metadata">

**Author:** ![crazy\_canuck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a587f6/32.png) [@crazy\_canuck](https://www.ruby-forum.com/u/crazy_canuck)\
**Post date:** [July 15, 2009, 7:39am UTC](https://www.ruby-forum.com/t/generating-a-view-from-a-controller/172121/3 "2009-07-15T07:39:38Z")

</div>

Hello–

On Jul 14, 2009, at 9:50 PM, crazy canuck wrote:

> ruby script/generate controller hello index
> 
> but when i type localhost:3000 all i get is the  
> “welcome aboard, your riding Ruby on Rails.”
> 
> home screen not my Hello#index page.
> 
> any help would be much appreciated, thanks in advance.

Good news! You have your server running. Now you need to delete public/  
index.html which is just a placeholder page and the one you are  
currently seeing. You also have to modify config/routes.rb to include  
something like:

map.root :controller =\> “hellos”

That tells the Rails routing system that the root of your application  
(where someone goes if they go to ‘/’) should be to the default action  
in the HellosController. If your controller is really called  
HelloController, then:

map.root :controller =\> “hello”

Hope this helps.
