Recipe project created first recipe but then

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.

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 [email protected] wrote:

RAILS_ROOT: ./script/…/config/…
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/

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” [email protected]

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;

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs