# Recipe project created first recipe but then

**URL:** <https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481>\
**Category:** Rails\
**Created:** [February 5, 2007, 6:08am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481 "2007-02-05T06:08:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Rae](https://www.ruby-forum.com/u/Rae)\
**Post date:** [February 5, 2007, 6:08am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481/1 "2007-02-05T06:08:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Rae](https://www.ruby-forum.com/u/Rae)\
**Post date:** [February 5, 2007, 6:47am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481/2 "2007-02-05T06:47:50Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://www.jeremymcanally.com/)

My free Ruby e-book:  
[http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![Rae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Rae](https://www.ruby-forum.com/u/Rae)\
**Post date:** [February 5, 2007, 7:04am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481/3 "2007-02-05T07:04:50Z")

</div>

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” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Rae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Rae](https://www.ruby-forum.com/u/Rae)\
**Post date:** [February 5, 2007, 6:49am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481/4 "2007-02-05T06:49:50Z")

</div>

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;

---

<div class="post-metadata">

**Author:** ![Rae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@Rae](https://www.ruby-forum.com/u/Rae)\
**Post date:** [February 5, 2007, 7:06am UTC](https://www.ruby-forum.com/t/recipe-project-created-first-recipe-but-then/84481/5 "2007-02-05T07:06:50Z")

</div>

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
