title: Select option required Ruby Rails
body: <p>I have a mix of ruby rails code
  I have a form with a selection option that i want to be a required, and i want to validate. If user do not select anything i want to validade with a error message.
  However, I try to copy past code from internet, I'm new at ruby rails and I still not have a error message.
  I also check that i use 'required' , or if i use 'validates_presence_of' doesn't make difference because it's a submit form (i think)</p>
  
  <p>test_filteR_form.rb</p>
  
  <pre><code>class TestFilterForm &lt; ApplicationForm
  
    attribute :model,                 String
    validates_presence_of :model
  end
  </code></pre>
  
  <p>.html.erb</p>
  
  <pre><code>  &lt;%= f.input :fill_form_error_message,:as =&gt; :hidden, :input_html =&gt; { :value =&gt;I18n.t('test.fill_form_error') } %&gt;
    &lt;%= f.input :model, label: I18n.t('test.filters.model'), autofocus: true, input_html: {class: 'input-xlarge chosen-select' }, collection: TestType.options_for_select, include_blank: true %&gt;
  </code></pre>
  
  <p>"/></p>
  
  <p>controller</p>
  
  <pre><code> def paginate
      @test_form = TestForm.new(params)
      unless @test_form.valid?
        @model = params[:test_filter_form][:model]
        @h_model = @model.pluralize + 'H'
        @history, _query,  @test_fields = TestQueryService.search!(params)
  
        session[:test_query] = _query
        session[:test_klass] = @model
      else
        format.json { render :json =&gt; { :error =&gt; @test_form.errors.full_messages }, :status =&gt; 422 }
      end
  </code></pre>
  
  <p>js.coffee</p>
  
  <pre><code> $contentDiv.on 'ajax:error', 'form[data-value]', (event, xhr, status, error) -&gt;
      data    = $.parseJSON(xhr.responseText)
      $result = $(@).parents('tr').find('[data-result]')
      controller.resultUpdateError xhr.status, $result.data('result'), data, $(@)
      # Hide row loading spinner
      $(@).parents('tr').find('span[role="result_update_spinner"]').hide()
      # Hide saved form
      $(@).parents('tr').find('.saved_form').hide()
  
  
    resultUpdated: (result, data, $form) -&gt;
      if data.flash != undefined
        # Sets a sucess message on page top
        flash data.flash.type, data.flash.message
  
      # Sets a success message on row
      $fieldForm = $form.parents('tr').find(".messages")
      $fieldForm.find('.controls').empty()
      $fieldForm.find('.control-group .controls').css('color', 'green').append @_inlineMessage("Gravado com sucesso")
  
      # Hide success message after some time
      setTimeout ((self) -&gt;
        -&gt;
          $fieldForm.find('.control-group .controls').empty()
          return
      )(this), 4000
  </code></pre>