Hey. I am a bit confused, seems to be simple thing, but anyhow it does not work for me: class Foo has_many(:bars) end class Bar belongs_to(:myfoo, :class_name => ''Foo'') end b = Bar.new().myfoo = Foo.find_by_name(''COOKIE_MONSTER'') b.save() The bar table got a FK field for Foo: "foo_id". As long as I do not choose an extra relation name, this works. But in this case, when I name the relation "myfoo" and give informationen about the class name, ActiveRecord fails an says <Column ''foo'' does not exist.> Why is there no "_id" appended? I also tried to deliver the :foreign_key parameter, but I did not succeed. As I said: If I name the relation "foo", all the things work. Do you have an idea? Thanks for helping! Cheers, ms --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey. I am a bit confused, seems to be simple thing, but anyhow it does not work for me: class Foo has_many(:bars) end class Bar belongs_to(:myfoo, :class_name => ''Foo'') end b = Bar.new(). b.myfoo = Foo.find_by_name(''COOKIE_MONSTER'') b.save() The bar table got a FK field for Foo: "foo_id". As long as I do not choose an extra relation name, this works. But in this case, when I name the relation "myfoo" and give informationen about the class name, ActiveRecord fails an says <Column ''foo'' does not exist.> Why is there no "_id" appended? I also tried to deliver the :foreign_key parameter, but I did not succeed. As I said: If I name the relation "foo", all the things work. Do you have an idea? Thanks for helping! Cheers, ms --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---