app/controllers/enrollments_controller.rb
# Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet only allow the white list through .
def enrollment_params
      is_new = false
      student = params.require(:enrollment)[:student]
      if student == nil
        student = params.require(:enrollment)[:student_attributes]
        is_new = true
      end
      if !is_new
        student = Person.find(student)
      else
        student = Person.new(student[0])
        student.save
      end
      params.require(:enrollment).permit(student_attributes: [:first_name, :last_name, :email, :email_confirmation, :password, :password_confirmation]).merge(:student => student)
    end
def enrollment_params is_new = false student = params . require ( :enrollment ) [ :student ] if student == nil student = params . require ( :enrollment ) [ :student_attributes ] is_new = true end if ! is_new student = Person . find ( student ) else student = Person . new ( student [ 0 ] ) student . save end params . require ( :enrollment ) . permit ( student_attributes : [ :first_name , :last_name , :email , :email_confirmation , :password , :password_confirmation ] ) . merge ( :student => student ) end
Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet only allow the white list through .