date_select in rails , How do I get the selected value?
<p>My view file is below.</p>

<pre><code>&lt;div class="field"&gt;
    &lt;%= f.label :deadline , class:"form-label"  %&gt;&lt;br /&gt;
    &lt;%= f.date_select( :deadline , use_month_numbers: true , start_year: (Time.now.year) , end_year: (Time.now.year+1) , start_month: (Time.now.month) , end_month: (12) , start_day: (Time.now.day) , end_day: (days_in_month(Time.now.month)) , default: Date.new(Time.now.year , Time.now.month , Time.now.day) , date_separator: '/' ) %&gt;
&lt;/div&gt;
</code></pre>

<p>days_in_month(Time.now.month) is helper method.</p>

<pre><code>def days_in_month(month, year = Time.now.year)
   common_year_days_in_month = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
   return 29 if month == 2 &amp;&amp; Date.gregorian_leap?(year)
   common_year_days_in_month[month]
end
</code></pre>

<p>In this case , when user selects 'month', 'day' doesn't change.
For example, in 2016-12-28, The page shows 2016/12/28 in default, and the end_day is 31 because 12 month has 31 days. But although user selects 11 month , end_day is 31 because 12 month has 31 days. in the case , I want to show 30 in end_day. Please help me...</p>