Forum: Ruby on Rails Eager loading with inheritance

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Josh (Guest)
on 2007-03-09 06:01
(Received via mailing list)
In order to implement inheritance (STI was not ideal), I have
implemented a solution similar to what is described in this post:  I have one model that
acts as a parent class with shared attributes, two child models with
different attributes, and a module that contains shared functionality
for the child models.

The issue arises in creating associations with other models when it is
necessary to provide conditions on the association, for example:

  has_many :foos, :conditions => "foo_metadata.created_at <
                           :order         => ' DESC,

I can use eager loading to include the foo_metadata relationship,
however, this becomes cumbersome and difficult to manage throughout
the application.  Is there an alternative solution to this problem?
Would composed_of (or other composition options) be of any help?

This topic is locked and can not be replied to.