Second table column data lift


#1

have placements, clients and case_managers tables with relationships

Trying to create new placement record…case_manager_id field exists in
clients table. I need the value from related clients record in
placements table

in placements_controller.rb

def create
@placement = Placment.new(params[:placement])
case_manager_id = Client.case_manager_id # this doesn’t work
if @placement.save
flash[:notice] = ‘Placement was successfully created’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

How do I get the case_manager_id value from the related record since I
am already storing the client_id (the foreign key) because I need the
foreign key for case_manager_id or I cannot save?

Craig