module ActionView::Helpers::DateHelper
def datetime_select(object_name, method, options = {}, html_options = {})
datetime_select("article", "written_on", prompt: true) # generic prompts for all
datetime_select("article", "written_on", prompt: { hour: true }) # generic prompt for hours
datetime_select("article", "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("article", "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 article variable
datetime_select("article", "written_on", ampm: true)
# Generate a datetime select with hours in the AM/PM format
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("article", "written_on", start_year: 1995)
# article 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("article", "written_on")
# attribute.
# Generates a datetime select that, when POSTed, will be stored in the article variable in the written_on
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 = {}) Tags::DatetimeSelect.new(object_name, method, self, options, html_options).render end