I have a two tables named Employee and Shop
Class Employee < ActiveRecord::Base
belongs_to :shop
end
&
Class Shop < ActiveRecord::Base
has_many :employees
end
An employee say with name abc can have more than one shop if an employee have 10 shops then there will be 10 rows with same employee name but same employeeID(a column present in employee table)
Problem is i have a form (edit employee) where i try to edit an employees detail. So i need to list all the shops inside a select tag with shops that comes under this employeeID as selected. I tried different ways. Not working. please help. Please dont vote me down iff my quiestion is wrong.
I tried different ways.please post some of your attempt.