title: Ruby: Use f.select or f.text_field if "other" is chosen in f.select
body: <p>I need ruby to either take the value from an f.select or an f.text_field if 'other' is chosen in the select form. how is this possible?
  in the view:</p>
  
  <pre><code>&lt;div class="field"&gt;
    Parent&lt;/br&gt;
    &lt;% f.label :parent1 %&gt;
    &lt;%= select("jobs","parent1_id",["None","8.5x11","shells"]) %&gt;
    Other:
    &lt;% f.label :parent2 %&gt;
    &lt;%= text_field("jobs","parent2_id") %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>in the controller:</p>
  
  <pre><code>def create
    @job = Job.new(params[:job])
  
      if params[:parent1_id] == "None" #params[:option1_id].nil? #params.has_key?(:option1_id) #Take your pick
          @job.parent = params[:parent2_id]
      else
          @job.parent = params[:parent1_id]
      end
  
    respond_to do |format|
  
      if @job.save
        format.html { redirect_to @job, :notice =&gt; 'Job was successfully created.' }
        format.json { render :json =&gt; @job, :status =&gt; :created, :location =&gt; @job }
      else
        format.html { render :action =&gt; "new" }
        format.json { render :json =&gt; @job.errors, :status =&gt; :unprocessable_entity }
      end
    end
  end
  </code></pre>