I have a list of 'Interests' that each user in my system has the ability to rate. An admin can add/remove Interests at any time. When the user goes to edit their account, I want to show a list of all the Interests in the system, and a drop down with a 1..5 value. I am wondering how I set this up..
Using accepts_nested_attributes for doesn't seem to work because when I use a field_for it wants to create the form for each of the Interests that have been saved. What I want is for each of the interests to show up, and on save, if the user has rated the interest before, it updates the value, if it has not been rated before, then add a new entry.
Currently a User:
has_many :user_interests, :dependent => :destroy
has_many :interests, :through => :user_interests, :foreign_key => :user_id
accepts_nested_attributes_for :user_interests
Currently a UserInterest:
belongs_to :user
belongs_to :interest
Currently an Interest:
has_many :user_interests, :dependent => :destroy
has_many :users, :through => :user_interests, :foreign_key => :interest_id, :dependent => :destroy