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.

Komentar

Postingan populer dari blog ini

EPrT English Proficiency Test Soal - soal

cara memunculkan dan menyembunyikan icon date, time, clock, volume, network, power battery, action center pada taskbar pada Windows 7

Cara Mengurus Perpanjang SIM dan Rincian Biaya di Lumajang.