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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
George Bailey
2007-Sep-19 18:27 UTC
Re: Create method calling wrong column name in a table
On Sep 19, 2007, at 12:12 PM, White Wizzard 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 modelDo you have a belongs_to :model statement? That would cause it to expect to find a model_id column. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
White Wizzard
2007-Sep-20 13:40 UTC
Re: Create method calling wrong column name in a table
Thank you , Your help enabled me to solve my problem --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---