I'm trying to do the following but getting a bit confused about how to setup the polymorphic has many through.
Class Topic
end
Class Post
end
Class Podcast
end
Class ResourceTopics
# This table has the following fields: [topical_type, topical_id]
end
I need to be able to query both ways so for example:
a) Podcast.first.topics #=> [Topic 1, Topic 2, etc]
b) Topic.first.podcasts #=> [Podcast 1, Podcast 2, etc]
I have tried several ways but none of which are working correctly. Can someone please help?
has_many :throughassociations and for each you specify the class.