I have a Contact
class associated with User
class as follows
class Contact < ActiveRecord::Base
belongs_to :users
end
In my edit I want to show a dropdown with list of user name as options that component should bind with contact.user_id
.
How to achieve this?
There are a number of ways to achieve this, here is one example.
This creates an array of contact.user.name and contact.user.id and submits the selected contact based on the associated user_id to your controller.
You will find more information here.