module ActionView::Helpers::DateHelper
def datetime_select(object_name, method, options = {}, html_options = {})
datetime_select("post", "written_on", :prompt => true) # generic prompts for all
datetime_select("post", "written_on", :prompt => {:hour => true}) # generic prompt for hours
datetime_select("post", "written_on", :prompt => {:day => 'Choose day', :month => 'Choose month', :year => 'Choose year'})
# Generates a datetime select with a custom prompt. Use :prompt=>true for generic prompts.
datetime_select("post", "written_on", :discard_type => true)
# as the written_on attribute.
# Generates a datetime select that discards the type that, when POSTed, will be stored in the post variable
datetime_select("trip", "departing", :default => 3.days.from_now)
# be stored in the trip variable in the departing attribute.
# Generates a datetime select with a default value of 3 days from the current time that, when POSTed, will
datetime_select("post", "written_on", :start_year => 1995)
# post variable in the written_on attribute.
# Generates a datetime select with a year select that starts at 1995 that, when POSTed, will be stored in the
datetime_select("post", "written_on")
# attribute
# Generates a datetime select that, when POSTed, will be stored in the post variable in the written_on
==== Examples
If anything is passed in the html_options hash it will be applied to every select tag in the set.
by +object+).
specified datetime-based attribute (identified by +method+) on an object assigned to the template (identified
Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a
def datetime_select(object_name, method, options = {}, html_options = {}) InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_select_tag(options, html_options) end