# Fixture\_references: "Mysql::Error #HY000"?

**URL:** <https://www.ruby-forum.com/t/fixture-references-mysql-error-hy000/109030>\
**Category:** Rails\
**Created:** [July 10, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/fixture-references-mysql-error-hy000/109030 "2007-07-10T19:05:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugh\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d2c977/32.png) [@Hugh\_S](https://www.ruby-forum.com/u/Hugh_S)\
**Post date:** [July 10, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/fixture-references-mysql-error-hy000/109030/1 "2007-07-10T19:05:18Z")

</div>

I’ve been trying to use fixture references, and I seem to be getting  
lots  
of:

1. Error:  
test\_truth(DeviceTest):  
ActiveRecord::StatementInvalid: Mysql::Error: #HY000Field  
‘description\_id’ doesn  
‘t have a default value: INSERT INTO devices (`id`) VALUES (2)  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/connection  
\_adapters/abstract\_adapter.rb:128:in `log' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection _adapters/mysql_adapter.rb:243:in `execute’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/fixtures.r  
b:290:in `insert_fixtures' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:289:in `each’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/fixtures.r  
b:289:in `insert_fixtures' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:257:in `create\_fixtures\_without\_references’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/fixtures.r  
b:257:in `each' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:257:in `create\_fixtures\_without\_references’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/connection  
\_adapters/abstract/database\_statements.rb:59:in `transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:255:in `create\_fixtures\_without\_references’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/base.rb:86  
7:in `silence' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:248:in `create\_fixtures\_without\_references’  
/home/hgs/aeg\_intranet/csestore/config/…/vendor/plugins/fixture\_references/  
lib/fixture\_references.rb:92:in `create_fixtures' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.r b:593:in `load\_fixtures’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/fixtures.r  
b:538:in `setup’

But AFAICS the fixture data looks OK

# Read about fixtures at [http://ar.rubyonrails.org/classes/Fixtures.html](http://ar.rubyonrails.org/classes/Fixtures.html)

\<%  
fixtures :devices, :descriptions  
%\>  
olympus400\_in:  
id: 1  
description\_id: \<%= descriptions(:C\_400, ‘id’) %\>  
serialno: 238553902  
barcode: 16301  
state: ‘in stock’  
categorypath: ‘Still Picture Camera’  
lock\_version: 1

and I tried the old form  
description\_id: \<%= descriptions(:C\_400)[‘id’] %\>

but get the same error. The data does exist in the descriptions table:

C\_400:  
:text: Olympus C-400 Zoom  
🆔 7  
:picture: “”

What is puzzling me is that 1) I don’t assume a default, 2) MySQL error  
numbers are normally purely numeric, and google maps this HY000 to many  
things…

Any idea what I should be looking at for this, please? This is  
rails 1.2.3 under cygwin.

```
    Thank you,
    Hugh

```
