mardi 20 octobre 2020

Send data from view page to function in controller language ruby

I have a code html dropDowns with 2 option English And Arabicand a button Save

Code in view page :

<div class="box">
          
          <div class="label-field-pair">
              <label for="languages"><%= "Choose Language" %></label>
              <div class="text-input-bg">
              <select name="language" id="language">
              <option value="english">English</option>
              <option value="arabic">Arabic</option>
              </select>
              </div>
          </div>

         <div id="submit-button">
              <%= submit_tag "► #{t('save')}" %>
          </div> 
      </div>

When i choose 1 of option and click in save button i want to send data to fucntion in controller

Controller :

class LanguagesController < ApplicationController
  def save
    

    
  end
end

Function save only get data of option (English or Arabic) and update table language in database. Easy to me to update table but i don't know how to get data from view to function in controller.

Code in ruby

Aucun commentaire:

Enregistrer un commentaire