select_second(datetime, options = {})
public
Returns a select tag with options for each of the seconds 0 through 59 with
the current second selected. The second can also be substituted
for a second number. Override the field name using the :field_name
option, ‘second’ by default.
Show source
def select_second(datetime, options = {})
second_options = []
0.upto(59) do |second|
second_options << ((datetime && (datetime.kind_of?(Fixnum) ? datetime : datetime.sec) == second) ?
%(<option value="#{leading_zero_on_single_digits(second)}" selected="selected">#{leading_zero_on_single_digits(second)}</option>\n) :
%(<option value="#{leading_zero_on_single_digits(second)}">#{leading_zero_on_single_digits(second)}</option>\n)
)
end
select_html(options[:field_name] || 'second', second_options, options[:prefix], options[:include_blank], options[:discard_type], options[:disabled])
end