Joining the same model twice in a clean way, but making the code reusable
- by Shako
I have a model Painting which has a Paintingtitle in each language and a Paintingdescription in each language:
class Painting < ActiveRecord::Base
has_many :paintingtitles, :dependent => :destroy
has_many :paintingdescriptions, :dependent => :destroy
end
class Paintingtitle < ActiveRecord::Base
belongs_to :painting
…