1
How do I pass the value that is in the field "codigo" of table "mesas" to the space Below "VALOR_STRING_BANCO"?
How do I pass the value found in the field "codigo" table "mesas" into the space below "VALOR_STRING_BANCO".
CONTROLLER
class MesasController < ApplicationController
          before_action :set_mesa, only: [:show, :edit, :update, :destroy]
        require 'rqrcode_png'
          # GET /mesas
          # GET /mesas.json
          def index
            @mesas = Mesa.all
            # Preciso colocar a string que está no banco dentro deste campo abaixo, "VALOR_STRING_BANCO".
            @qr = RQRCode::QRCode.new("VALOR_STRING_BANCO").to_img.resize(90, 90).to_data_url
          end
          # GET /mesas/1
          # GET /mesas/1.json
          def show
          end
          # GET /mesas/new
          def new
            @mesa = Mesa.new
          end
          # GET /mesas/1/edit
          def edit
          end
          # POST /mesas
          # POST /mesas.json
          def create
            @mesa = Mesa.new(mesa_params)
            respond_to do |format|
              if @mesa.save
                format.html { redirect_to @mesa, notice: 'Mesa was successfully created.' }
                format.json { render :show, status: :created, location: @mesa }
              else
                format.html { render :new }
                format.json { render json: @mesa.errors, status: :unprocessable_entity }
              end
            end
          end
          # PATCH/PUT /mesas/1
          # PATCH/PUT /mesas/1.json
          def update
            respond_to do |format|
              if @mesa.update(mesa_params)
                format.html { redirect_to @mesa, notice: 'Mesa was successfully updated.' }
                format.json { render :show, status: :ok, location: @mesa }
              else
                format.html { render :edit }
                format.json { render json: @mesa.errors, status: :unprocessable_entity }
              end
            end
          end
          # DELETE /mesas/1
          # DELETE /mesas/1.json
          def destroy
            @mesa.destroy
            respond_to do |format|
              format.html { redirect_to mesas_url, notice: 'Mesa was successfully destroyed.' }
              format.json { head :no_content }
            end
          end
          private
            # Use callbacks to share common setup or constraints between actions.
            def set_mesa
              @mesa = Mesa.find(params[:id])
            end
            # Never trust parameters from the scary internet, only allow the white list through.
            def mesa_params
              params.require(:mesa).permit(:cadeiras, :codigo, :observacao, :reservada)
            end
        end
Sites I’ve been researching: https://github.com/DCarper/rqrcode_png and http://www.codingricky.com/qrcodes-in-rails/
I considered using the Google API Qrcodes for the time being.
– marquescharlon