Module: TimeOfDayAttr::FormBuilderExt

Extended by:
ActiveSupport::Concern
Defined in:
lib/time_of_day_attr/form_builder_ext.rb

Instance Method Summary collapse

Instance Method Details

#time_of_day_field(method, options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/time_of_day_attr/form_builder_ext.rb', line 7

def time_of_day_field(method, options = {})
  options[:value] ||= begin
    value = object.public_send(method)
    TimeOfDayAttr.localize(value, options.extract!(:format, :omit_minutes_at_full_hour))
  end
  text_field(method, options)
end