Artist.first.medias returns all medias. Media is an STI. Media can be
video or painting.

How do I return all paintings of an artist? Only paintings, not
videos?

In my Artist model, I tried putting:

  has_many :paintings, :through => :medias

In console, I do:

  Artist.first.paintings.all

And I get:

  ActiveRecord::HasManyThroughSourceAssociationNotFoundError: Could
not find the source association(s) :painting or :paintings in model
Media.  Try 'has_many :paintings, :through => :medias, :source =>
<name>'.  Is it one of :artist?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to