# Model validation causing rake db:migrate to fail silently

**URL:** <https://www.ruby-forum.com/t/model-validation-causing-rake-db-migrate-to-fail-silently/109129>\
**Category:** Rails\
**Created:** [July 11, 2007, 6:54pm UTC](https://www.ruby-forum.com/t/model-validation-causing-rake-db-migrate-to-fail-silently/109129 "2007-07-11T18:54:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elegant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ab097/32.png) [@elegant](https://www.ruby-forum.com/u/elegant)\
**Post date:** [July 11, 2007, 6:54pm UTC](https://www.ruby-forum.com/t/model-validation-causing-rake-db-migrate-to-fail-silently/109129/1 "2007-07-11T18:54:43Z")

</div>

I added a migration that adds data with a model class, calling create().  
Validation in the model class fails, so the rows aren’t being added to  
the database. But when I run ‘rake db:migrate’, it says nothing about  
the failures, causing me frustration when rake looks like it worked, but  
the data doesn’t get loaded.

I’m new to rails; is there something I’m missing about getting rake (or  
a migration, at least) to display its errors the same way that rails  
does (at least via the scaffold)?

Thanks,  
Dave

---

<div class="post-metadata">

**Author:** ![elegant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ab097/32.png) [@elegant](https://www.ruby-forum.com/u/elegant)\
**Post date:** [July 11, 2007, 7:02pm UTC](https://www.ruby-forum.com/t/model-validation-causing-rake-db-migrate-to-fail-silently/109129/2 "2007-07-11T19:02:05Z")

</div>

try using create! which will raise an exception if the record is  
invalid.

---

<div class="post-metadata">

**Author:** ![elegant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ab097/32.png) [@elegant](https://www.ruby-forum.com/u/elegant)\
**Post date:** [July 11, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/model-validation-causing-rake-db-migrate-to-fail-silently/109129/3 "2007-07-11T19:29:24Z")

</div>

Chris H. wrote:

> try using create! which will raise an exception if the record is  
> invalid.

Awesome, that’s exactly what I want to see.

Thanks,  
Dave
