title: Input/Output Values
body: <p>A have an <code>index.html.erb</code> page with selection of two options ("First", "Second") and three different textfields, in which may be inputed <code>a, b, c</code> values. <code>c</code> is needed only when "Second" option is selected. </p>
  
  <p>Then I have to perform a method, depending on which option is chosen: if it is the "First", i give to it my <code>a, b</code> and get one result, if it is "Second", then give <code>a, b, c</code> and proceed it to another method. </p>
  
  <p>I already have: </p>
  
  <p><em>app/views/welcome/index.html.erb</em></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Welcome&lt;/title&gt;
      &lt;%= stylesheet_link_tag 'application' %&gt;
      &lt;%= csrf_meta_tags %&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="mainbox"&gt;
          &lt;%= form_for(@data_lab) do |f| %&gt;
  
          &lt;%= options_for_select(disabled: "Select an option", ["First", "Second"]) %&gt;
  
          &lt;%= text_field(:a_value, class: "text_in") %&gt;
          &lt;%= text_field(:b_value, class: "text_in") %&gt;
          &lt;!-- Appears only when "Second" option is selected: --&gt;
          &lt;%= text_field(:c_value, class: "text_in") %&gt;
  
          &lt;%= f.submit %&gt;
  
          &lt;% end %&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p><em>app/controllers/welcome_controller.rb</em></p>
  
  <p><pre><code>class WelcomeController &lt; ApplicationController
    include WelcomeHelper
    require "#{Rails.root}/app/models/concerns/DataLab.rb"
    def index; end
    def welcome
      @data_lab = DataLab.new
      @data_lab = params(data_params)
    end
  end
  </pre></code></p>
  
  <p><em>app/models/concerns/DataLab.rb</em></p>
  
  <p><pre><code>class DataLab &lt; ApplicationRecord
    attr_accessor :a_value, :b_value, :c_value
  end
  </pre></code></p>
  
  <p><em>app/helpers/welcome_helper.rb</em>
  <pre><code>module WelcomeHelper
    def data_params
      params_require(:data).permit(:a_value, :b_value, :c_value)
    end
  end
  </pre></code></p>
  
  <p>I've got stacked on <code>Could not find table 'data_labs'</code> error, but, I guess, I need to create a database for my data_lab class. </p>
  
  <p>How can I perform input/output correctly? How can I handle methods depending on my <code>options_for_select</code>?</p>