# Routing Error on rails3

**URL:** <https://www.ruby-forum.com/t/routing-error-on-rails3/184223>\
**Category:** Rails\
**Created:** [February 26, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223 "2010-02-26T21:47:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 26, 2010, 9:47pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/1 "2010-02-26T21:47:16Z")

</div>

Hi All,

I am new to Ruby on Rails and have rails3 installed.

After I type this on the command line

$rails g controller Pages home contact

then, I go to [http://localhost:3000/pages/home](http://localhost:3000/pages/home)

I got

Routing Error

No route matches “/pages/contact”

How can I fix this problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 26, 2010, 10:46pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/2 "2010-02-26T22:46:21Z")

</div>

On Fri, Feb 26, 2010 at 12:47 PM, John Wu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I got
> 
> Routing Error
> 
> No route matches “/pages/contact”
> 
> How can I fix this problem?
> 
> Thanks!

Please post your routes file.

-Conrad

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 26, 2010, 10:50pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/3 "2010-02-26T22:50:49Z")

</div>

Thanks for the reply.

I didn’t change rout file.

SampleApp::Application.routes.draw do |map|  
end

What do I need to add?

Conrad T. wrote:

> On Fri, Feb 26, 2010 at 12:47 PM, John Wu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I got
> > 
> > Routing Error
> > 
> > No route matches “/pages/contact”
> > 
> > How can I fix this problem?
> > 
> > Thanks!
> 
> Please post your routes file.
> 
> -Conrad

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 26, 2010, 11:03pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/4 "2010-02-26T23:03:16Z")

</div>

Thanks,

How to uninstall it on mac? Can I have two version of Rails on same  
machine that I can choose one to run?

Colin L. wrote:

> On 26 February 2010 20:47, John Wu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi All,
> > 
> > I am new to Ruby on Rails and have rails3 installed.
> 
> Did you really mean to start with rails 3? It is still under  
> development and you may well run into problems that are not of your  
> own making. If you are learning rails I would suggest installing the  
> latest 2.3.x and you will find getting started guides to help you get  
> going at [http://guides.rubyonrails.org](http://guides.rubyonrails.org). I believe that it is  
> necessary to uninstall rails 3 before installing 2.3.x though I may be  
> mistaken.
> 
> Colin

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 26, 2010, 10:53pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/5 "2010-02-26T22:53:57Z")

</div>

On 26 February 2010 20:47, John Wu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi All,
> 
> I am new to Ruby on Rails and have rails3 installed.

Did you really mean to start with rails 3? It is still under  
development and you may well run into problems that are not of your  
own making. If you are learning rails I would suggest installing the  
latest 2.3.x and you will find getting started guides to help you get  
going at [http://guides.rubyonrails.org](http://guides.rubyonrails.org). I believe that it is  
necessary to uninstall rails 3 before installing 2.3.x though I may be  
mistaken.

Colin

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [February 27, 2010, 2:24am UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/6 "2010-02-27T02:24:41Z")

</div>

Hello,

Here’s how your routes.rb file should like for that /pages/home route  
to work: [gist:316367 · GitHub](http://gist.github.com/316367)

In rails 3 rule for catching non-rest routes is deprecated so it’s  
commented out in routes.rb. You can read about it in Rails 3.0 Release  
Notes - [rails.info](http://guides.rails.info/3_0_release_notes.html#action-dispatch)

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 18, 2010, 7:05pm UTC](https://www.ruby-forum.com/t/routing-error-on-rails3/184223/7 "2010-03-18T19:05:59Z")

</div>

Rails 3 doesn't come with a generic rout mapping for controllers.  
The generator for models or scaffold will add the models as resources routes, so it will be RESTfull by default.  
  
It means that in any new rails 3 app, you will have to explicitly change the routes.rb to add the routes that are not related to a REST resource.  
Isn't it great? I love rails 3.  
  
[]'s  
  
Felipe  
  
Ugis Ozols wrote:

> ```
> Hello,
> 
> Here’s how your routes.rb file should like for that /pages/home route  
> to work: [http://gist.github.com/316367](http://gist.github.com/316367)
> 
> In rails 3 rule for catching non-rest routes is deprecated so it’s  
> commented out in routes.rb. You can read about it in Rails 3.0 Release  
> Notes - [http://guides.rails.info/3\_0\_release\_notes.html#action-dispatch](http://guides.rails.info/3_0_release_notes.html#action-dispatch)
> 
> On Feb 26, 10:47 pm, John Wu [\<removed\_email\_address@domain.invalid\>](mailto:removed_email_address@domain.invalid)  
> wrote:
> ```
> 
> > ```
> > Hi All,
> > 
> > I am new to Ruby on Rails and have rails3 installed.
> > 
> > After I type this on the command line
> > 
> > $rails g controller Pages home contact
> > 
> > then, I go tohttp://localhost:3000/pages/home
> > 
> > I got
> > 
> > Routing Error
> > 
> > No route matches “/pages/contact”
> > 
> > How can I fix this problem?
> > 
> > ## Thanks!
> > 
> > Posted viahttp://www.ruby-forum.com/.
> > ```
> 
> ```
> 
> ```

–   
  
You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
  
To post to this group, send email to  
removed\_email\_address@domain.invalid.  
  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.

For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en.](http://groups.google.com/group/rubyonrails-talk?hl=en.)
