# Basic question on controller; "no route matches for hello/world"

**URL:** <https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924>\
**Category:** Rails\
**Created:** [October 2, 2010, 11:10pm UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924 "2010-10-02T23:10:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [October 2, 2010, 11:10pm UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924/1 "2010-10-02T23:10:04Z")

</div>

Just starting out with RoR3, and have tried to render first page.

Here is code for hello\_controller.rb

class HelloController \< ApplicationController  
def world  
render :text =\> “

# Hello world!
”  
end  
end

Did not make any changes to the routes.rb file. When I went to  
[http://localhost:3000/hello/world](http://localhost:3000/hello/world) I got the following error:

ActionController::RoutingError (No route matches “/hello/world”):

Do I need to make changes to the routes.rb file? If so, what changes?

Thank you.

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [October 2, 2010, 11:52pm UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924/2 "2010-10-02T23:52:12Z")

</div>

On 10-10-02 05:09 PM, pauld wrote:

> Did not make any changes to the routes.rb file. When I went to  
> [http://localhost:3000/hello/world](http://localhost:3000/hello/world) I got the following error:
> 
> ActionController::RoutingError (No route matches “/hello/world”):
> 
> Do I need to make changes to the routes.rb file? If so, what changes?
> 
> Thank you.

first follow the MVC convention of writing correct rails code, put view  
code in the views. get out of the habit now to write view code in the  
controller, the controller should be kept lean and mean as possible

try putting the following line in routes.rb

get ‘hello/world’

–  
Kind Regards,  
Rajinder Y.

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [October 3, 2010, 12:42am UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924/3 "2010-10-03T00:42:32Z")

</div>

On Sat, Oct 2, 2010 at 5:09 PM, pauld [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Did not make any changes to the routes.rb file. When I went to  
> [http://localhost:3000/hello/world](http://localhost:3000/hello/world) I got the following error:
> 
> ActionController::RoutingError (No route matches “/hello/world”):
> 
> Do I need to make changes to the routes.rb file? If so, what changes?

you are trying yo use this ====\> match  
‘:controller(/:action(/:id(.:format)))’

read!

# This is a legacy wild controller route that’s not recommended for

RESTful applications.

# Note: This route will make all actions in every controller

accessible  
via GET requests.

# match ‘:controller(/:action(/:id(.:format)))’

you are trying to access an action like this

hello/world =====\> # match ‘:controller(/:action)’

with that line commented is not possible to access actions the old non  
restfull way.

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [October 3, 2010, 1:35am UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924/4 "2010-10-03T01:35:13Z")

</div>

Thank you very much, got it to work.

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [October 3, 2010, 10:55am UTC](https://www.ruby-forum.com/t/basic-question-on-controller-no-route-matches-for-hello-world/195924/5 "2010-10-03T10:55:11Z")

</div>

Read:

> **[\#203 Routing in Rails 3 - RailsCasts](http://railscasts.com/episodes/203-routing-in-rails-3)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://edgeguides.rubyonrails.org/routing.html)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

- 

> **[\#231 Routing Walkthrough Part 1 - RailsCasts](http://railscasts.com/episodes/231-routing-walkthrough)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

> **[\#232 Routing Walkthrough Part 2 - RailsCasts](http://railscasts.com/episodes/232-routing-walkthrough-part-2)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

Robert Pankowecki
