and wanted to list all the subscribers, but show what level their
subscriptions was (level is in subscriptions table), how would I best do
that?
Do I have to use my own select to get what I want or are the attributes
from subscriptions available to me through the join somehow (I am
suspecting not)?
attributes
from subscriptions available to me through the join somehow (I am
suspecting not)?
Hmm… not sure I see that there’s much of a problem here, since you
have a standard has_many association between newsletters and
subscriptions. So you can simply do:
This is also what you would do if you wanted a custom sort order on
the returned subscriptions (or subscribers). I suppose there might be
a fancier way of doing this, but I’ll let Josh S. handle that.
attributes
from subscriptions available to me through the join somehow (I am
suspecting not)?
Hmm… not sure I see that there’s much of a problem here, since you
have a standard has_many association between newsletters and
subscriptions. So you can simply do:
This is also what you would do if you wanted a custom sort order on
the returned subscriptions (or subscribers). I suppose there might be
a fancier way of doing this, but I’ll let Josh S. handle that.
You rang?
When doing a query with a has_many :through, the attributes for the join
model are in fact available, and you can use them in :select and
:conditions options, so you can use a :select to include the level
attribute in the result of the query.