###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/