Langsung ke konten utama

Postingan

Menampilkan postingan dari Mei, 2017

Rails select_month and select_year pre populate parameter

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.