Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert No route matches with {:method...

Replytotopic

No route matches with {:method=>:get} Error in AWDWR Book

Posted in Forums : Ask a Rails expert

 
Profile

Authority 12
Posting Rating 0
Sign in to rate this post

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

 
Dsc00495-medium;brt:55

Authority 50
Posting Rating 57
Sign in to rate this post

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/

 
Profile

Authority 12
Posting Rating 87
Sign in to rate this post

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.

Ed

 
Profile

Authority 12
Posting Rating 87
Sign in to rate this post

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

Ed

 
Jqtcungqf6beajq7tiof0w9zkslnxun9rjhvi-penjm?feat=directlink

Authority 12
Posting Rating 95
Sign in to rate this post

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.

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this 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?

 
Img_4570

Authority 37
Posting Rating 87
Sign in to rate this post

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.

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this post

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

 
Profile

Authority 0
Posting Rating 0
Sign in to rate this post

Thank you a lot!

 
Member_2328890

Authority 37
Posting Rating 0
Sign in to rate this post

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…

Replytotopic

Other Recent Topics

Ask a Rails expert : nested application ApplicationController get called intead of children::ApplicationController

Ask a Rails expert : Best way to structure a database for a large/static dataset

Ask a Rails expert : Ruby Developer (ROR) - Scottish based (Remote working from within the UK)

Ask a Rails expert : Above Ground Pool Supplies

Ask a Rails expert : How to get url params in observer or model in Rails 3.1

Ask a Rails expert : What can persuade you to hire Junior Ruby devs with significant PHP experience?

Ask a Rails expert : What industry value does the Ruby or Rails Certification currently have?

Ask a Rails expert : Louis Vuitton Damier Azur Canvas specially sale ( www.salecheaplouisvuitton.com )

Ask a Rails expert : ·How to check errors/puts statements from ruby files which are under cronob

Ask a Rails expert : Louis Vuitton cheap Soft Sided Luggagespecial offer( www.salecheaplouisvuitton.com )

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel