class MedicalHistoriesController < ApplicationController

  before_action :user_is_employee?
  before_action :set_medical_history, only: [:edit, :update]
  layout "admin"

  def edit
  end

  def update
    @medical_history.update(medical_history_params)
  end

  private

    def set_medical_history
      @medical_history = MedicalHistory.find(params[:id])
      @user = @medical_history.user
    end

    def medical_history_params
      params.require(:medical_history).permit(:diseases, :speciality, :hobbie, :occupation, :gym, :gym_name, :medicines, :injuries, :stress, :regimen, :civil_state, :speciality, :lives_alone, :company_at_home, :childrens, :childrens_ages, :food_rhythm, :food_boredom, :food_where_when, :supermarket, :meals_out, :take_supplements, :phone_sleep, :phone_wakeup, :self_criticism, :stress_management, :objective, :goal_barriers, :soda, :alcohol, :dislikes, :likes, :habitual_feed, :supplementation, :steroids, :exercise, :training_time, :notes, :training_age, :available_days, :training_days, :novelty_program, :physical_stress, :recover, :force, :external_recover, :sleep_hours, :training_place, :injuries_detail, :stress_detail, :alcohol_detail)
    end

end