I setup a HABTM relationship between my post model, genre model, and genres_posts model. My genre model has a name:string attribute which consists of names like 'thriller' 'western' 'horror' 'action' comedy' etc, when a user creates a post they can add 1 or more genres to the post.
I need to be able to list all of a user's posts by the specific genre, so they can easily switch back and forth between all their posts with genre 'western' and all the posts with genre 'action'.
Post.last.genres gives me the post's genres, but how would I do it for an array of a user's posts such as @user.posts ?? and then specify the specific genre name?
Is this the smartest way to do this type of thing?