My Code:
models:
has_many :skill_users, :dependent => :destroy
has_many :users, :through => :skill_users
has_many :skill_users, :dependent => :destroy
has_many :skills, :through => :skill_users
belongs_to :user
belongs_to :skill
skilluser table
-id
-skill_id
-user_id
-rating
form:
simple_form_for @user ....
Skill.all.each do |skill|
hidden_field_tag "user[skill_ids][]"
check_box_tag "user[skill_ids][]", skill.id,
@user.skills.include?(skill),
{ :id => "user_skills_ids_"+ skill.id.to_s}
skill.name
Rails 3.2
How do I manage to get the rating attribute attached to each checkbox and stored
in the db? I can''t find a solution Googling.
Would be great to get some help..
tried this:
hidden_field_tag "skill_users[][skill_id]", skill.id
text_field_tag "skill_users[][rating]"
but no success.
Thanks
Werner
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/BCWoAqO9ucQJ.
For more options, visit https://groups.google.com/groups/opt_out.