audiointrigue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Dec-28 05:35 UTC
populating a table with IRB
I am new to ruby and rails so I dedided to work through the "How to build a wiki in 20 minutes" tutorial and ran up on this snag... the past hour of my 20 minute blog has been searching the web trying to figure out where my syntax error is in the following: Page.new( :name => ''FrontPage'', :content => ''Welcome to *my* front page.'').save => true I have combed both the rails api and the ruby api and searched here about 50 times and still come up empty handed. I do realize this tutorial is a little dated but I am enjoying this one a lot more than the ones on OnLamp so I really want to work through this problem. I appreciate your patience with the newb on this one. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
audiointrigue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > I am new to ruby and rails so I dedided to work through the "How to > build a wiki in 20 minutes" tutorial and ran up on this snag... the > past hour of my 20 minute blog has been searching the web trying to > figure out where my syntax error is in the following: > > Page.new( :name => ''FrontPage'', :content => ''Welcome to *my* front > page.'').save => true > > I have combed both the rails api and the ruby api and searched here > about 50 times and still come up empty handed. I do realize this > tutorial is a little dated but I am enjoying this one a lot more than > the ones on OnLamp so I really want to work through this problem. I > appreciate your patience with the newb on this one.That''s the tutorial here: http://sl33p3r.free.fr/tutorials/rails/wiki/wiki-en.html The bit that you are struggling with is shown as: script/console Loading development environment. >> Page.new( :name => ''FrontPage'', :content => ''Welcome to *my* front page'').save => true >> The bit that says "=> true" after the save is IRB showing you the result of the save - it isn''t part of the code you type in. Hope that helps Justin Forder --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
audiointrigue > Page.new( :name => ''FrontPage'', :content => ''Welcome to *my* front > page.'').save => true Use create instead of new + save Page.create (:name => ''FrontPage'', ..) Later you can even write code like ` book.pages<< Page.create(...) Alain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---