Displaying 2 results from an estimated 2 matches for "add_technician_with_skil".
Did you mean:
add_technician_with_skills
2006 Jun 21
0
how to save objects associated via has_many :through?
...et''s change to the scenario where all 3
separate objects are NEWLY created, joined and saved.
Here''s how I think it would work. Please correct me where I''m wrong.
# in some controller, assume a form is being passed in to fill out the
# Technician and Skill objects
def add_technician_with_skills
@technician = Technician.new(params[:technician])
@skills = Skills.new(params[:skill])
begin
@technician.add_skills(@skills)
@technician.save!
rescue => err
# error handling
end
# other processing
end
# in technician.rb model
def add_skills(skills)
begin...
2006 Jun 22
0
how to save objects in a has_many :through association?
...et''s change to the scenario where all 3
separate objects are NEWLY created, joined and saved.
Here''s how I think it would work. Please correct me where I''m wrong.
# in some controller, assume a form is being passed in to fill out the
# Technician and Skill objects
def add_technician_with_skills
@technician = Technician.new(params[:technician])
@skills = Skills.new(params[:skill])
begin
@technician.add_skills(@skills)
@technician.save!
rescue => err
# error handling
end
# other processing
end
# in technician.rb model
def add_skills(skills)
begin...