Undefined method

hi,
I am trying to add a page to my exisiting database and for some reason
I get an error of “no method” I searched a lot but my problem did not
get solved, so i’d appreciate if anyone can help me with this:
I am trying to add a page called new_lab which is linked through my
labs page, here is my controller:
#new lab
def show1
@hide_sidebar = true
@patient = Patient.find(params[:id])

end

def new_lab
@hide_sidebar = true
@patient = params[:id]
@nlab = @patient.nlabs.build(:patient_id => @patient.id)

end

def create_lab
@hide_sidebar = true
@nlab = Nlab.new(params[:nlab])
if @nlab.save
flash[:notice] = ‘Lab was successfully created.’
redirect_to :action => ‘show1’
else
render :action => ‘new_lab’
end

end

I get an error of “undefined method `nlabs’” and I already made a
model and a table by that name. I don’t understand what I am doing
wrong.

Thanks,

@patient = params[:id] should be changed to:
@patient = Patient.find params[:id]

Otherwise it’s just a string, and has no method called “nlabs”.