title: gem Ransack custom search for only Year instead of full date
body: <p>I have a Rails 5.1 application and a Ransack search form with a dropdownlist containing some database columns. One of the column is finish_date and has values in format eg "2007-12-31". In the input field I have to type exactly the full date to get a match but I want to change the behaviour that it accepts only the year as input value.</p>
  
  <p>How can I pass in a custom predicate that transforms the input value from full date eg. 2007-12-31 to only year?</p>
  
  <p>What I'm looking for is a Ransack equivalent for the sql query:</p>
  
  <pre><code>SELECT *
   FROM imagecapturing
   WHERE YEAR(finish_date) = 2007
  </code></pre>
  
  <p>My Ransack form:</p>
  
  <pre><code>&lt;%= search_form_for @search do |f| %&gt;
    &lt;%= f.grouping_fields(f.object.new_grouping) do |g| %&gt;
      &lt;%= g.condition_fields(g.object.new_condition) do |c| %&gt;
        &lt;%= c.predicate_select only: %i(cont not_eq eq) %&gt;
        &lt;%= c.value_fields do |v| %&gt;
          &lt;%= v.text_field :value %&gt;
        &lt;% end %&gt;
      &lt;% end %&gt;
    &lt;% end %&gt;
    &lt;%= f.submit "filter" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>in my controller:</p>
  
  <pre><code>  @search = Imagecapturing.ransack params[:q]
    @imagecapturings = @search.result.page params[:page]
  </code></pre>