我有一个选择年份,我想检查一年是否匹配:
<%= select_year(Date.today, {start_year: 2015, end_year: Date.today.year} %>
默认名称是date [year],我想比较查询中的值,如:
where("YEAR(date) = ?", x)
x将是年份,但我不能让它发挥作用。我从控制器传递它,如:
@result = Model.function(params[:date][:year])
但我一直在&#34;未定义的方法`[]&#39;为零:NilClass&#34;即使我看到它通过&#34;参数:{&#34; utf8&#34; =&gt;&#34;✓&#34;,&#34; date&#34; =&gt; {&#34;年&#34; = GT;&#34; 2015&#34;}}&#34;