Help: insert into multiple tables

Trying to figure out how to do an insert into multiple tables from one
form.

Models:
class Canbackground < ActiveRecord::Base
belongs_to :candidate
has_many :canindustries
end

class Canindustry < ActiveRecord::Base
belongs_to :canbackground
end

The form looks like this:

<% form_for :canbackground, :url => canbackground_url, :candidate_id =>
@candidate_id do |form| %> #restful with nested routes

canbackground is nested route of candidate

<%= collection_select(:canbackground, :edureq_id, @edureqs, :id, :name, { :prompt => true })%> # gets inserted into canbackground model/table ................................. <%= collection_select(:canindustry, :category_id, @categories, :id, :name,{},"multiple"=>'multiple',"size"=>5) %> # should get inserted into canindustries table

I’m sure the controller is where I need to do something , just not sure

def new
@canbackground = Canbackground.new
@candidate_id = params[:candidate_id]
end

def create
@canbackground = Canbackground.new(params[:canbackground])
if (@candidate.canbackgrounds << @canbackground)
redirect_to candidate_url(@candidate)
else
render :action => :new
end
end

The candidate_id will need to be inserted into the canindustry model.
Not
sure if I need the canbackground_id in the canindustry model.

TIA
Stuart