Displaying 1 result from an estimated 1 matches for "trait_values".
2009 Feb 15
3
conditions on association include, hacky but more or less solved
...ldn''t always be loaded. This is similar to putting
a condition on a has_many association in a model, but the condition is
dynamic rather than predefined.
The situation I had is
@entity = Entity.find(params[:id])
@traits = Trait.find :all,
:include => [:trait_values => [:key_factors]]
but I only want the key_factors that connect to the given entity to be
loaded.
E.g. I have entities Jane and Marco, and traits Height (with values
Short, Medium, and Tall) and HairColor (with values Red, Brown, and
Black). Key factors connect an entity with a trait value and...