Ruby on Rails Saturday, May 21, 2016

this looks like a very interesting project, I've been having some issues with assigning associations thru a form on an related type of app, getting a form that crates an polymorphic association when a provider creates an order and such. would you be up for an email chat on the topic by chance? I've a demo application up here: https://warm-river-76092.herokuapp.com thanks for posting the solution to your issue!

On Sunday, May 15, 2016 at 12:53:11 PM UTC-4, Luis wrote:
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/29eab942-45e6-488f-aa88-c47a585779fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment