Skip to content

Instantly share code, notes, and snippets.

@dvgica
dvgica / am_pm_time_select.rb
Created November 4, 2011 18:41
Initializer to add am/pm support to time_select helpers in Rails 3 (3.1 has an option, use it!)
# modified from Bruno Miranda's original found here: http://brunomiranda.com/past/2007/6/2/displaying_12_hour_style_time_select/
# usage: <%= form.time_select :the_time, { :twelve_hour => true } %>
module ActionView
module Helpers
class DateTimeSelector
def select_hour_with_twelve_hour_time
datetime = @datetime
options = @options