SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Mar 20, 2008, 18:41 #1
- Join Date
- Mar 2008
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
chapter 5 problem (and earlier, pg 140)
It started the same as this post: http://www.sitepoint.com/forums/showthread.php?t=531057
so i did the script/destroy on my model/controller. Then ran:
$ script/generate scaffold Contact name:string email:string
Then i figured i needed my controller again so i ran the controller:
$ script/generate controller Story
So i try and see the page via: script/server
and i get:
Routing Error
No route matches "/story" with {:method=>:get}
I know this has been done improperlly now but I really do not know where to start again (how do i get rid of EVERYTHING properly to start fresh?). What do i run and what should i not run when i restart ?
This is all new to me, so now following a book which is out of date is becoming troublesome.
(the book just incase there more than one is "Build Your Own Ruby on Rails Web Applications")
Thanks for the help in advance.
-brianp
-
Mar 21, 2008, 10:28 #2
- Join Date
- Mar 2008
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
update
Hey,
So this morning i re-created by rails project.
Edited my db.yml
ran:Code:script/generate scaffold Story name:string link:string
Routing Error
No route matches "/story/" with {:method=>:get}
(at uri: http://localhost:3000/story)
after some looking into different files i found uri http://localhost:3000/stories/ worked like i wanted it too. But what do i do if the controller is supposed to be called Story, and not stories ?
-
Mar 22, 2008, 11:41 #3
If you're using Rails 2.0, the default scaffold expects to pluralize your controllers (which is the RESTful way of doing things). That's why you get stories, not story. If you look at your config/routes.rb file, your route is probably set up as map.resources :stories.
To be honest, I'd try to stick with the plural controller form. That just seems the way that Rails expects things nowadays, and it's not going to be changing any time soon. If you look into REST and how Rails leverages it, it really starts to make sense, too..
Zach Holman
good-tutorials — blog — twitter — last.fm
Bookmarks