Is there a better way to get all of these records?

http://pastie.caboo.se/79914 - i'd like to get all of the graphics of
a certain *category* (not theme) by specifying the category id, but
none of the graphics are associated with a category_id, just a
theme_id. i included a solution i came up with that works fine, but it
seems kind of weird. anyone know of an alternative method/way to go
about doing this?

rob

Hi Rob

You can use a has_many :through here to get the graphics

class Category < AR:B

has_many :themes

has_many :graphics, :through => :themes

end

class Theme < AR:B

has_many :graphics

end

class Graphic < AR:B

belongs_to :theme

end

Then you can get the graphics for a category like this

@graphics = Category.find( params[:id] ).graphics

HTH

Daniel