Repeating has_many calls on the same model

Hi,

I currently have a model with (amongst others) the following
declarations in it:

has_many :live_action_personnel,
:class_name => “Credit”,
:include => :credit_type,
:order => ‘credit_types.position,
credits.position ASC’,
:group => ‘credit_types.personnel_type’,
:conditions =>
‘credit_types.personnel_type=“live_action_personnel”’

has_many :production_personnel,
:class_name => “Credit”,
:include => :credit_type,
:order => ‘credit_types.position,
credits.position ASC’,
:group => ‘credit_types.personnel_type’,
:conditions =>
‘credit_types.personnel_type=“production_personnel”’

so the association is on ‘Credit’ both times, but with a sql condition.

Is this a bad thing to do?
Am I likely to suffer as-yet unknown horrible consequences doing such a
thing?

I considered using single table inheritance, but that’s not really much
use because the condition is dependent upon a 2nd order association.

Just wanted to check…

dorian


I do things for love or money

dorian mcfarland wrote:

so the association is on ‘Credit’ both times, but with a sql condition.

Is this a bad thing to do?
Am I likely to suffer as-yet unknown horrible consequences doing such a
thing?

Not at all. I use special associations (need a better term for them)
frequently to simplify access using conditions.


Josh S.
http://blog.hasmanythrough.com