class User < ActiveRecord::Base
class List < ActiveRecord::Base
class Celeb < ActiveRecord::Base
I want to load a user's list, and include the celebs that belong to it. I
tried the following:
@user = current_user
... @list = user.list.joins(:celebs)
... @list = user.list(:include => :celebs)
... @list = user.list.includes(:celebs)
The result was some errors/unexpect output. The expected query is:
SELECT * FROM lists INNER JOIN lists.id ON celebs.list_id WHERE
lists.user_id = @user_id
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QtXHPBoCAOwJ.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.