Forum: Ruby on Rails How can i specify default time to datetime_select tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2689ef6ed6006970c3d153075df3df18?d=identicon&s=25 Jigar Gosar (Guest)
on 2006-02-05 19:36
I want to specify a different default time to datetime_select tag how
can i do that.


also i was looking at rails helper code

-----------------------------------------------------------------------
module ActionView
  module Helpers
    module DateHelper

def to_datetime_select_tag(options = {})
        defaults = { :discard_type => true }
        options  = defaults.merge(options)
        options_with_prefix = Proc.new { |position|
options.merge(:prefix =>
"#{@object_name}[#{@method_name}(#{position}i)]") }
        datetime = options[:include_blank] ? (value || nil) : (value ||
Time.now)

        datetime_select  = select_year(datetime,
options_with_prefix.call(1))
        datetime_select << select_month(datetime,
options_with_prefix.call(2)) unless options[:discard_month]
        datetime_select << select_day(datetime,
options_with_prefix.call(3)) unless options[:discard_day] ||
options[:discard_month]
        datetime_select << ' &mdash; ' + select_hour(datetime,
options_with_prefix.call(4)) unless options[:discard_hour]
        datetime_select << ' : ' + select_minute(datetime,
options_with_prefix.call(5)) unless options[:discard_minute] ||
options[:discard_hour]

        datetime_select
      end
-----------------------------------------------------------------------

i was wondering where did the variable value come from in follong line:

 datetime = options[:include_blank] ? (value || nil) : (value ||
Time.now)
This topic is locked and can not be replied to.