I have Employee and Skillset which are joined through an Association
employees_skillsets. When I use the for to add a new employee and
mapping one or more id’s from skillset into employee_skillset_ids
everything works. Where I have issues is in two places
-
When I destroy an employee or a skillset the associated records are
not automatically removed from employees_skillsets -
How do I create an assocoation in the console.
@employee = Employee.find(:first)
=> #<Employee id: 100, >>
@skillset = Skillset.find(107)
=> #<Skillset id: 107, ">@employee.skillsets[0] = @skillset
=> #<Skillset id: 107, >@employee.save
=> true
Does not work.
@employee.skillset_ids
=> []
What is the form doing?
@employee.skillset_ids[0] = 107
=> 107@employee.skillset_ids
=> []