title: Rails : Check if field is blank on submit
body: <p>In a rails application i've a search field that i must control (on the submit action) if it's blank. 
  This one is not connected to a table for register some data:</p>
  
  <pre><code> &lt;%= form_tag products_path, :method =&gt; 'get' do %&gt;
    &lt;%= text_field_tag :search, params[:search]%&gt;
    &lt;%= submit_tag "Ricerca" %&gt;   
   &lt;% end %&gt;
  </code></pre>
  
  <p>i've tried define an action in my controller for check the value of the parameters that i pass:</p>
  
  <pre><code>if !(params[:search].present?)
    redirect_to root_path, error: 'Insert a research key'
  else
    @count = Product.search(params[:search]).count
  
    if @count == 0
      redirect_to root_path, error: 'No data found for your search'
    else
      @products = Product.search(params[:search])
    end
  end
  </code></pre>
  
  <p>Any idea for the validation of my field throught Rails?</p>