Ruby on Rails Sunday, May 15, 2016

I fix the problem.
It is very annoying when this types of mistakes do not generate an error. 
(It is almost as bad as my day of c programming chasing a memory leak.
 dgb to the rescue.)

class PatientsController < ApplicationController
def create
   
@patient = Patient.new(patient_params)
   
@elig =@patient.build_elig  patient_params["elig_attributes"] #***** I was missing this line
   
debugger
    respond_to
do |format|
     
if @patient.save
        format
.html { redirect_to @patient, notice: 'Patient was successfully created.' }
        format
.json { render :show, status: :created, location: @patient }
     
else
        format
.html { render :new }
        format
.json { render json: @patient.errors, status: :unprocessable_entity }
     
end
   
end
 
end


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cc78ccab-babe-45b7-8c7c-48bebadcd1c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment