I am using Rails 3.1. Here is the code that I have that asks the user to enter the validity and credit card expiration dates.
<div class="field"> <%= f.label :expires_on, 'Expiration date' %> <br /> <%= select_month nil, {add_month_numbers: true}, {name: 'creditcard[month]', id: "card_month"} %> <%= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: 'creditcard[year]', id: "card_year"} %> </div>
It works on the code. However, the problem is that if there was a validation error, then the selected expiration time and month are reset.
I tried f.select_month , but this is not supported.
source share