Displaying 2 results from an estimated 2 matches for "have_and_belong_to_mani".
Did you mean:
have_and_belong_to_many
2006 Jan 02
3
Selecting conditionally from HABTM
Hello,
I was wondering whether there is a nice Rubyesque way of selecting
from a pair of HABTM models where one of them is inherited from
another object.
Here is the situation:
I have a ''posts'' table from which ''replies'' and ''articles'' are
inherited. Articles have_and_belong_to_many categories, but neither
posts nor replies do (it just does
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall.
Thanks to Wilson for converting to the new form. I''ve added a few
lines. Basically, it iterates over your model associations and does
two things.
- First, just try to call the association. Usually fixes speeling
erors or other such silliness.
- Second, try to find a record with an :include on the association.
This