I go the tutorial recipe example to create the form and type in the hot chips with descripiton etc., and it was successful. Then I tried to create the next one as told by the tutorial, but then got the error message below: ActiveRecord::StatementInvalid in RecipeController#create Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO recipes (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace ...... Request Parameters: {"commit"=>"Create", "recipe"=>{"date(1i)"=>"2007", "title"=>"Hot chips", "date(2i)"=>"2", "date(3i)"=>"5", "description"=>"really hot", "instructions"=>"sprinkle with pepper"}} Show session dump --- flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} What did I do wrong?? thanks for any help. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Did you make sure the id column is auto-increment? Not sure if that''s the problem, but it might be. --Jeremy On 2/5/07, Rae <Raeka8-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > I go the tutorial recipe example to create the form and type in the > hot chips with descripiton etc., and it was successful. Then I tried > to create the next one as told by the tutorial, but then got the error > message below: > > ActiveRecord::StatementInvalid in RecipeController#create > Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO recipes > (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', > ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') > RAILS_ROOT: ./script/../config/.. > > Application Trace | Framework Trace | Full Trace > ...... > > Request > Parameters: {"commit"=>"Create", "recipe"=>{"date(1i)"=>"2007", > "title"=>"Hot chips", "date(2i)"=>"2", "date(3i)"=>"5", > "description"=>"really hot", "instructions"=>"sprinkle with pepper"}} > Show session dump > --- > flash: !map:ActionController::Flash::FlashHash {} > > Response > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > What did I do wrong?? > thanks for any help. > > > > >-- http://www.jeremymcanally.com/ My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.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 -~----------~----~----~----~------~----~------~--~---
You should notice this message: Duplicate entry ''0'' for key 1: INSERT INTO recipes (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') It means that you are trying to input "non duplicated field" in the db. Hence, ''Hot chips'' is inserted twice, while it''s not allowed (since title field is non duplicated) ~inung; On Feb 5, 12:07 pm, "Rae" <Rae...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> I go the tutorial recipe example to create the form and type in the > hot chips with descripiton etc., and it was successful. Then I tried > to create the next one as told by the tutorial, but then got the error > message below: > > ActiveRecord::StatementInvalid in RecipeController#create > Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO recipes > (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', > ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') > RAILS_ROOT: ./script/../config/.. > > Application Trace | Framework Trace | Full Trace > ...... > > Request > Parameters: {"commit"=>"Create", "recipe"=>{"date(1i)"=>"2007", > "title"=>"Hot chips", "date(2i)"=>"2", "date(3i)"=>"5", > "description"=>"really hot", "instructions"=>"sprinkle with pepper"}} > Show session dump > --- > flash: !map:ActionController::Flash::FlashHash {} > > Response > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > What did I do wrong?? > thanks for any help.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks!! That was it. I checked auto increment for the id column and that did it. I''m using a trial version of Navicat SQL and had to find my way through it since its different than the mysql-front that tutorial uses. I had problems trying to make my tables with HeidiSQL, the free replacement they''re using. Does anyone know of another freebie SQL front end that''s bug free? On Feb 5, 12:47 am, "Jeremy McAnally" <jeremymcana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Did you make sure the id column is auto-increment? Not sure if that''s > the problem, but it might be. > > --Jeremy > > On 2/5/07, Rae <Rae...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I go the tutorial recipe example to create the form and type in the > > hot chips with descripiton etc., and it was successful. Then I tried > > to create the next one as told by the tutorial, but then got the error > > message below: > > > ActiveRecord::StatementInvalid in RecipeController#create > > Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO recipes > > (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', > > ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') > > RAILS_ROOT: ./script/../config/.. > > > Application Trace | Framework Trace | Full Trace > > ...... > > > Request > > Parameters: {"commit"=>"Create", "recipe"=>{"date(1i)"=>"2007", > > "title"=>"Hot chips", "date(2i)"=>"2", "date(3i)"=>"5", > > "description"=>"really hot", "instructions"=>"sprinkle with pepper"}} > > Show session dump > > --- > > flash: !map:ActionController::Flash::FlashHash {} > > > Response > > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > > What did I do wrong?? > > thanks for any help. > > --http://www.jeremymcanally.com/ > > My free Ruby e-book:http://www.humblelittlerubybook.com/book/ > > My blogs:http://www.mrneighborly.com/http://www.rubyinpractice.com/- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No, that wasn''t it because the first time I had tried creating a different recipe. Then just kept trying the original. But thanks anyways. But I''ll play with this too to see if it will take duplicate entries. Rae On Feb 5, 12:49 am, "inung" <inungsatri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You should notice this message: > Duplicate entry ''0'' for key 1: INSERT INTO recipes > (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', > ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') > > It means that you are trying to input "non duplicated field" in the > db. Hence, ''Hot chips'' is inserted twice, while it''s not allowed > (since title field is non duplicated) > > ~inung; > > On Feb 5, 12:07 pm, "Rae" <Rae...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > > I go the tutorial recipe example to create the form and type in the > > hot chips with descripiton etc., and it was successful. Then I tried > > to create the next one as told by the tutorial, but then got the error > > message below: > > > ActiveRecord::StatementInvalid in RecipeController#create > > Mysql::Error: #23000Duplicate entry ''0'' for key 1: INSERT INTO recipes > > (`title`, `date`, `description`, `instructions`) VALUES(''Hot chips'', > > ''2007-02-05'', ''really hot'', ''sprinkle with pepper'') > > RAILS_ROOT: ./script/../config/.. > > > Application Trace | Framework Trace | Full Trace > > ...... > > > Request > > Parameters: {"commit"=>"Create", "recipe"=>{"date(1i)"=>"2007", > > "title"=>"Hot chips", "date(2i)"=>"2", "date(3i)"=>"5", > > "description"=>"really hot", "instructions"=>"sprinkle with pepper"}} > > Show session dump > > --- > > flash: !map:ActionController::Flash::FlashHash {} > > > Response > > Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} > > > What did I do wrong?? > > thanks for any help.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---