Create method calling wrong column name in a table

I have a multitable database with an observer logging changes into a
datachange table.

The create method inserts the data into the data change table, updates
my model, and then trys to load from the datachange table. When it
does this it WHERE clause that is generated for me is looking for a
column model_id which I dont have. I don’t want to even have a field
because this table will be loggin changes for all models and having
the ids stored is undesirable.

The generated sql statment is SELECT * FROM datachanges WHERE
datachanges.model_id = 56
where 56 is the id of the model

Any help to fix this error would be appreciated

Since it generates that SQL based on what you specify in your model and
migration code, you should post the relevant snippets of that code.

On Sep 19, 2007, at 12:12 PM, White W. wrote:

I don’t want to even have a field
because this table will be loggin changes for all models and having
the ids stored is undesirable.

The generated sql statment is SELECT * FROM datachanges WHERE
datachanges.model_id = 56
where 56 is the id of the model

Do you have a belongs_to :model statement?
That would cause it to expect to find a model_id column.

Thank you ,
Your help enabled me to solve my problem

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs