# Create\_spec fails INSERT INTO

**URL:** <https://www.ruby-forum.com/t/create-spec-fails-insert-into/131296>\
**Category:** Rails\
**Created:** [March 7, 2008, 7:37pm UTC](https://www.ruby-forum.com/t/create-spec-fails-insert-into/131296 "2008-03-07T19:37:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [March 7, 2008, 7:37pm UTC](https://www.ruby-forum.com/t/create-spec-fails-insert-into/131296/1 "2008-03-07T19:37:57Z")

</div>

###USER CONTROLLER###  
#####################

@spec = current\_user.spec  
@spec = current\_user.create\_spec unless @spec

###################################################  
class User \< ActiveRecord::Base #class definition  
has\_one :spec  
has\_one :presentation  
has\_one :entry

###################################################  
class Spec \< ActiveRecord::Base  
belongs\_to :user  
###################################################

This should work for creating a new empty row in my Specs table  
Studying the logs even more I notice how it skips doing “INSERT  
INTO”…what the hell am I doing wrong? The only real difference between  
the other tables is that the Specs Table contains more columns…but  
otherwise they’re all using the same code. I can’t see that using more  
columns could be a problem. Why does it skip the INSERT INTO??

################################################  
Log  
################################################

e[4;36;1mPresentation Load (0.000000)e[0m e[0;1mSELECT \* FROM  
presentations WHERE (presentations.user\_id = 11) LIMIT 1e[0m

e[4;35;1mPresentation Columns (0.000000)e[0m e[0mSHOW FIELDS FROM  
presentationse[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mBEGINe[0m  
e[4;35;1mSQL (0.000000)e[0m e[0mINSERT INTO presentations  
(`user_id`, `pres`) VALUES(11, NULL)e[0m  
e[4;36;1mSQL (0.031000)e[0m e[0;1mCOMMITe[0m

e[4;35;1mEntry Load (0.031000)e[0m e[0mSELECT \* FROM entries WHERE  
(entries.user\_id = 11) LIMIT 1e[0m  
e[4;36;1mEntry Columns (0.000000)e[0m e[0;1mSHOW FIELDS FROM  
entriese[0m  
e[4;35;1mSQL (0.000000)e[0m e[0mBEGINe[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mINSERT INTO entries (`user_id`,  
`image`) VALUES(11, NULL)e[0m  
e[4;35;1mSQL (0.047000)e[0m e[0mCOMMITe[0m

e[4;36;1mSpec Load (0.000000)e[0m e[0;1mSELECT \* FROM specs WHERE  
(specs.user\_id = 11) LIMIT 1e[0m  
e[4;35;1mSpec Columns (0.016000)e[0m e[0mSHOW FIELDS FROM specse[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mBEGINe[0m  
e[4;35;1mSQL (0.000000)e[0m e[0mCOMMITe[0m  
Redirected to [http://localhost:3000/](http://localhost:3000/)
