Preface: I''m trying to find my way through the "Build Your Own Ruby on Rails Web Application" book. I''m completely new to programming and am having a hard time figuring out the differences between rails 2.0.2 and what''s in the book so please forgive me if this is a stupid question. I''m confused because I finally thought I''d figured out the whole scaffolding thing but when I try to generate a scaffold for "Story", it creates EVERYTHING as "stories". I even have to go to http://localhost:3000/stories instead of http://localhost:3000/story to see the scaffold. When I generate a scaffold for "stories" it makes the exact same thing. Am I missing something? I''m running this in Terminal a Mac OS 10.5.2 (Leopard) with MySQL, Rails 2.0.2 and Ruby 1.8.6, and WeBRICK Here''s the code, the only commands I did before this is $rails -d mysql shovell $cd shovell admins-macbook:shovell Admin$ script/generate scaffold Story name:string link:string exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/stories exists app/views/layouts/ exists test/functional/ exists test/unit/ create app/views/stories/index.html.erb create app/views/stories/show.html.erb create app/views/stories/new.html.erb create app/views/stories/edit.html.erb create app/views/layouts/stories.html.erb create public/stylesheets/scaffold.css dependency model exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/story.rb create test/unit/story_test.rb create test/fixtures/stories.yml create db/migrate create db/migrate/001_create_stories.rb create app/controllers/stories_controller.rb create test/functional/stories_controller_test.rb create app/helpers/stories_helper.rb route map.resources :stories Then I just run $rake db:migrate and everything works fine at http://localhost:3000/stories -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 20, 2008, at 10:38 PM, Kelly Tanguay wrote:> I''m confused because I finally thought I''d figured out the whole > scaffolding thing but when I try to generate a scaffold for "Story", > it > creates EVERYTHING as "stories". I even have to go to > http://localhost:3000/stories instead of http://localhost:3000/story > to > see the scaffold. When I generate a scaffold for "stories" it makes > the > exact same thing. Am I missing something?You''re doing the right thing. Controllers are plural, models are singular. You''ll have to do the translation between what''s printed in the book and how Rails'' scaffold works. By observing these pluralization rules, routing becomes far easier, so unless you''re keen to swim upstream don''t try to force controllers into singular form. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---