Rails select_month and select_year pre populate parameter

11.21 Muhamad Akbar Bin Widayat 0 Comments

Hi all, I want to share to you how to pre populate parameter into your form.
<%= select_month(params[:month].present? ? params[:month].to_i : Date.today.month, {}, {name: 'month'}) %>
<%= select_year(params[:year].present? ? params[:year].to_i : Date.today.year, {start_year: 2017, end_year: Date.today.year}, {name: 'year'}) %>
I hope this will help you.

0 komentar:

terimakasih komentarnya