tapitapi’s blog

1日1杯タピオカ!エンジニア

【Ruby on Rails】simple form date型input書き方

railsで誕生日などdate型のinputを書く際に詰まったのでメモ

(gem simple form を使用しています)

 

= simple_form_for(@user, html: { class: 'form-horizontal', autocomplete: "off" }, wrapper: :horizontal_form) do |f|

= f.input :bday, as: :date, start_year: Date.today.year - 30,
end_year: Date.today.year - 12,
use_month_numbers:true,
order: [:day, :month, :year]

太字の部分をオプションで付ける。

オプションのドキュメントはコチラ↓

api.rubyonrails.org

 

以上ですーーー

 

おやすみーーー