Join Association Question

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

1. When I destroy an employee or a skillset the associated records are
not automatically removed from employees_skillsets

2. 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

=> []

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

1. When I destroy an employee or a skillset the associated records are
not automatically removed from employees_skillsets

2. 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

=> []

Have you tried:
  >> @employee.skillsets << @skillset

What is the form doing?

@employee.skillset_ids[0] = 107

=> 107

@employee.skillset_ids

=> []

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com

What worked is

employee = ...
skillset = ...
employeeskillset =
EmployeesSkillset.new(:employee=>employee, :skillset =>skillset)
employeeskillset.save

I did now know about this extra object.

I tried your suggestion and that works as well! Cool, thanks.