views:

20

answers:

0

I am working on a Ruby on Rails project where people can keep a diary for diseases or health conditions of their interest. They can (de)select multiple topics in their preferences with the help of checkboxes, and get disease specific questions and tracking options for their 'diseases of interest' on their personalized site. I am not very satisfied with the way I have implemented this though. What I have done is make a rich many-to-many relation between a user table and a table containing the disease names to select. I also made a table for each disease and made one-to-many relations between these tables and the user table. I now coded in the view file to check if a checkbox for a certain disease name is checked and if so, to show the corresponding disease table items for this user. There is a lot of repetition of code this way which I could probably solve by making a helper method or so. However, the whole design seems awkward to me. I figure there must be a better, standard way to deal with this kind of construction, but am unable to find it. How would you deal with this problem? Please be kind: I am new to RoR, mySQL and programming in general...

Rene