K
K
kramidev2015-02-23 08:09:55
HTML
kramidev, 2015-02-23 08:09:55

RubyOnRails active admin. How to specify the origin in datetime input?

807edbc5a4a54e81a3863f14b9866ed3.pngHi all. There is a field in the datetime model and a formtastic form in active admin f.input :begin. Datetime in formattastic works through select. How to specify the countdown of the year for example from 2015 to 2050?

form html: { multipart: true } do |f|
    f.inputs do
      f.input :title
      f.input :preview
      f.input :content, as: :ckeditor
      f.input :begin # ???
      f.input :place     
    end    
  end

Solution (very simple):
f.input :begin, :start_year => Date.today.year, end_year: Date.today.year + 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Vsk, 2015-02-23
@kramidev

Maybe add start_year, end_year. Something like this:
stackoverflow.com/questions/11386478/rails-3-simpl...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question