Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
No route matches with {:method=>:get} Error in AWDWR Book
10 Posts
No route matches with {:method=>:get} Error in AWDWR Book

Hi I'm working on the AWDWR book and I'm on the admin section of the book. I have rails 2 installed on my machine and I have ran into an error when I created my controller login but when I go to http://localhost:3000/login/index I get this error:

No route matches "/login/index" with {:method=>:get}

I haven't touched the routes.rb file and when I generated the controller I went:

ruby script/generate controller Login add_user login logout index delete_user list_users

The controller and views files were created correctly. Any help would be awesome.

Thanks, Tony

  1. Change the default root to the landing page from the routes.rb file to the desired location(say login/index) and delete the index file from public/

The AWDWR 2ed book was written for Rails 1.2.x. While most of the book is still applicable to Rails 2.0, there are enough differences that I would expect that folks going through the tutorial step-by-step almost certainly will hit a few really frustrating problems due to those differences.

I suggest installing Rails 1.2.6, the most up-to-date version of Rails that matches the version upon which the AWDWR book is based. I think you'll save yourself lots of headaches by doing so.


BTW, the command-line instruction to install a particular version of Rails (version 1.2.6, in this case) is this:

gem install rails --version 1.2.6


Please check your routes.rb file

This may be because of conditional mapping like

m.connect '',:controller=>'login',:action=>'index', :conditions => { :method => :post }

but such conditional routing are not generated by default.

Forum Rating: 100
Sign In To Rate Post

I had the same problem as Tony Bianco! I'm reading AWDWR 2ed book.

I uninstalled rails 2.0 and installed rails 1.2.6 as Ed Ruder said... and now it works!! Finally! Thanks!

But.. I have one question.. If I wanted to use rails 2.0, what should I do? Buy a new book?

AWDWR is still a valid book, as mentioned above. I still have it around as a decent general reference manual if I need to refresh my memory on something. However, that being said, a lot of what is in there has been deprecated in 2.0, and by no means should you go back to 1.2.x just because your tutorials or books won't work with them. 2.0 is where Rails is at now, this means that all the cutting edge Rails technologies are focused on Rails 2.0 and not on Rails 1.2.x. I cannot verify the usefulness of these screencasts, but http://www.rubyplus.org has a few screencasts working with the AWDWR in a Rails 2.0 setup. Free registration is required, but it might be a helpful place to start.

Perhaps these links might help if you want to use Rails 2.0 instead of going back to prev.versions : http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html http://fairleads.blogspot.com/2008/01/this-is-second-part-of-my-series.html

cheers, Jakub

Thank you a lot!

I ran into the same issue - I'm using the beta 3 version of ADWR - the problem is that on page 76 the screenshot is old. The address in to queue up the product listings view is http://localhost:3000/admin, when it should be http://localhost:3000/products

Hope this helps anyone who is stumped on page 76 of the latest beta 3 book...

10 Posts
Login to add your message