0
votes

Within my rails app I have two models. A User model and a Book model. A user uploads and has many books.

I'm trying to add 10 predefined categories to the user model, so that a user assigns as many of the 10 categories to themselves as they wish. For example, if i'm a user that uploads a several books, and the categories I chose in my user settings are "fiction" and "science"

If another user chooses "fiction", "science", "history" as their categories, I want to be able to show them all books uploaded by users that are under these three categories including all the books I uploaded since I am under the categories of "fiction" and "science"

What is the best way to implement this? I was thinking of using the acts-as-taggable-on gem but maybe this is too heavy weight and necessary. Should I just add a string column to my user model where each category is separated by a comma, so that I can split them up into an array and do queries with Active Record?

1

1 Answers

1
votes

Obviously you could create your own solution for the problem but ActsAsTaggableOn is a very good solution for it. It is not such a heavy weight as other gems.

Bonus: You can go back any time if it becomes too heavy for your application. Which I doubt.