I'm very new to ruby and rails so this is probably quite a simple question but very confusing to me.
I have users (with model, controller, views and everything all set up already). Now I want to introduce something where users can indicate what their preferences are. An example would be for users to indicate what their 5 favourite foods are, and then for me to be able to search for users by favourite food.
This being my first rails project, I'm a little unsure how to approach this. My thoughts so far:
1) Add a boolean array to my User model, render the array as checkboxes and then store it somehow. (I'm just not sure how to generate the migration for that, or how to search by food item if implemented like that).
2) Create a Food model and use the has_many
relationship in my User model to link users to foods. I imagine I'd then be able to search for users based on a food? I feel like a Food model might be overkill because it's not something that has any information relating to it. It is just something to attach to Users.
Any suggestions, code, hints or tips would be hugely appreciated.