Following line of code renders a set of data selects, and everything
about it works perfectly except that it refuses to set the order of the
date field to day, month and then year. I get the default year, month
day instead. What could I be doing wrong?
<%= select_date status_date.status_date, { :order => [:day, :month,
:year] } %>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
It looks like the :order argument for select_date was added for Rails
1.2. Are you running a pre-1.2 version of rails?
1.1.6 version
------------------
# Returns a set of html select-tags (one for year, month, and day) pre-
selected with the +date+.
def select_date(date = Date.today, options = {})
select_year(date, options) + select_month(date, options) +
select_day(date, options)
end
1.2.2 version
------------------
# Returns a set of html select-tags (one for year, month, and day) pre-
selected with the +date+.
# It''s possible to explicitly set the order of the tags using the
<tt>:order</tt> option with an array of
# symbols <tt>:year</tt>, <tt>:month</tt> and
<tt>:day</tt> in the
desired order. If you do not supply a Symbol, it
# will be appened onto the <tt>:order</tt> passed in.
def select_date(date = Date.today, options = {})
options[:order] ||= []
[:year, :month, :day].each { |o| options[:order].push(o) unless
options[:order].include?(o) }
select_date = ''''
options[:order].each do |o|
select_date << self.send("select_#{o}", date, options)
end
select_date
end
Aaron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Yep, that must be the problem. I haven''t updated rails for a little while on my development machine. Duh. Thanks for your help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---