mercredi 26 juin 2019

I want to concatinate two values into a single string

i have two different values systolic and diastolic blood pressure readings in string, i just want when those two values come from front-end i'll just store them into a single string E.g if systolic ='120' and diastolic='80' i want it to be bp='120/80'

module Api module V1 module CheckinMachine class BpsController < ApplicationController include MachineError before_action :authenticate_user!

    def create
      raise BatteryNotFunctionalError if battery_functional?
      # user = User.find_by!(bp_machine_imei: params[:imei])
      health_reading = current.health_readings.create!(key: :blood_pressure, value: bp_value)
      Solera::PostActivityApi.call(user,
                                   bp,
                                   health_reading.solera_activities.new)
      head :ok
    rescue ActiveRecord::RecordNotFound => _e
      render_machine_error and return
    end

    def show
      puts params
    end

    private

    def bp
      {
        systolic_blood_pressure: params[:systolic],
        diastolic_blood_pressure: params[:diastolic]
      }
    end
  end
end

end end

That's what i have tried, what do i do to make it exactly like i want it to be

like bp = '120/80'

Aucun commentaire:

Enregistrer un commentaire