To skip the part to tell you how you should fix your error, I would like to tell you how you should do the coding in the first place :) Correct if I am wrong.
In Routes.rb
you should have put(if not so already):
resources :client do
resources : contacts
end
Then, second in you view
file you should put something like this:
<%= link_to('new contact', new_client_contact_path(@client)) %>
In that way, you don't have to do anything in your create action, rails will manage all other things. That is the way it is supposed to be done
Edit:
just to make it more clear.
In new
action in your contacts
controller you should put:
user= user.find(params[:user_id])
#2nd you build a new one
@contact= user.contacts.build
And in your create
action in contacts
controller , you should put:
user = User.find(params[:user_id])
#2nd you create the contact with arguments in params[:contact ]
@contact = user.contact.create(params[:contact ])
response .....