app/controllers/eqconditions_controller.rb
# POST /conditions/1/create
# create a condition if it does not exist yet
POST /conditions/1/create
create a condition if it does not exist yet
POST / conditions / 1 / create create a condition if it does not exist yet
def create
    @patient = Patient.find(params[:id])
    @cdn = params[:code]
    if patient_has_condition(@patient, @cdn)
      redirect_to(new_condition_path, :notice => "Condition already exists!")
    else
      @eqcondition = create_condition(@patient, @cdn)
      if @eqcondition
        redirect_to(edit_condition_url(@patient.id, @eqcondition.id), :notice => "Condition created!")
      else
        redirect_to(new_condition_path, :notice => "Condition not created!")
      end
    end
  end
def create @patient = Patient . find ( params [ :id ] ) @cdn = params [ :code ] if patient_has_condition ( @patient , @cdn ) redirect_to ( new_condition_path , :notice => "Condition already exists!" ) else @eqcondition = create_condition ( @patient , @cdn ) if @eqcondition redirect_to ( edit_condition_url ( @patient . id , @eqcondition . id ) , :notice => "Condition created!" ) else redirect_to ( new_condition_path , :notice => "Condition not created!" ) end end end
POST /conditions/1/create
create a condition if it does not exist yet
POST / conditions / 1 / create create a condition if it does not exist yet
#@cdn = params[:eqcondition][:code]