I am a bit confused, seems to be simple thing, but anyhow it does not
work for me:
belongs_to(:myfoo, :class_name => ‘Foo’)
b = Bar.new().
b.myfoo = Foo.find_by_name(‘COOKIE_MONSTER’)
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