On Nov 5, 1:13 pm, TomRossi7 <
t...@themolehill.com> wrote:
> Why is belongs_to :through not an option with Rails? I'm sure there
> is something I'm missing! I find myself wanting it more now with lazy
> loading in Rails 3.
>
> project belongs_to client
>
> task belongs_to project
> task belongs_to client :through project
belongs_to :through is not necessary, which is why it's not an option.
So you are saying your tables would look like this:
TASK
name
project_id
PROJECT
name
client_id
CLIENT
name
And you would like to be able to find all tasks for a given client?
In that case, you would say client has_many :tasks, :through
=> :project
Then instead of "Task.joins(:project => :client)" You can do
"Client.find_by_name('asdf').tasks"