I have a page where I user's posts are displayed:
user.posts
I want to add the functionality to only show a user's posts of a certain category:
user.posts.where(category_id: category_id_variable)
To avoid duplication of code I wonder if it's possible to keep the code line above for both scenarios, i.e. somehow ignore the .where
method if I want to display all the user's posts?