On Sunday 12 Mar 2006 16:55, Stuart B. wrote:
I can’t seem to get a handle on how the select_time helper is supposed
to work. I’m a complete noob to rails so bear with me please. I’m trying
to add fields to a form to allow for time (hh:mm) selection ie. call
received, enroute, etc… I don’t understand how one maps the form data
to the table object and field ie. calls table recieved field.
(calls.recieved) The field is of type MySQL TIME. The API offers
“select_time(datetime = Time.now, options = {})” as the only
documentation for this helper. This doesn’t help me much. I’ve spent
several hours searching for answers but no joy.
I was going to try and help you out with a way of doing this, but it
seems
it’s not easily possible using current Gem Rails - since the command you
need
is “time_select” not “select_time”.
“Select_something” helpers give you just the raw selection boxes,
whereas
“Something_select” helpers supply them pre-selected for accessing a
specified
attribute on an object. At the moment, there isn’t a time_select helper
however, a patch on the following page should do what you need:
http://dev.rubyonrails.org/ticket/3811
I think you need just the last one:
http://dev.rubyonrails.org/attachment/ticket/3811/date_helper_mega_patch3.diff?format=txt
If you’ve never worked with .diff patch files before, here’s a general
howto:
http://www.linux.com/article.pl?sid=06/02/16/1938203
All Linux distros and I’m guessing OSX too have the patch tool as
standard.
If you’re on Windows, you probably need this:
I haven’t actually ever patched my own Rails install, but it shouldn’t
be
particularly difficult.
An easier way of getting this might be to run Edge Rails, but again,
this
isn’t something I’ve done myself. Still, looks pretty simple -
instructions
here:
http://wiki.rubyonrails.com/rails/pages/EdgeRails
Hope that helps!
~Dave
–
Dave S.
Rent-A-Monkey Website Development
PGP Key: http://www.rentamonkey.com/pgpkey.asc