How about having your Gallery, Product, and News belongs_to Image?
-----Original Message-----
From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Nuno
Sent: Saturday, April 15, 2006 8:32 AM
To: rails@lists.rubyonrails.org
Subject: [Rails] 3 models -> 1 image
Hello, I have 3 models (Galery, Product, News) which all have 0 or 1
Image
I don''t understand what the relationship between the 3 models and the
Image model should be.
I might goes to Galery has_one Image, Product has_one Image and News
has_one Image but I presume that active record will rely on Image model
having a foreign key related to only one owner model (eg.
Image.galery_id), which can''t be the case.
Any hint appreciated, thank you
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails