Select_time help needed (Noob)


#1

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.

Thanks


#2

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:

http://gnuwin32.sourceforge.net/packages/patch.htm

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
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc


#3

Thank you very much for the information. I eventually learned that I
would
need to either run edge rails or apply the patch. I have not done either
before so I appreciate the links. Wish me luck and thank you again.

View this message in context:
http://www.nabble.com/select_time-help-needed-(Noob)-t1268227.html#a3383306
Sent from the RubyOnRails Users forum at Nabble.com.


#4

I read the information on the pages you suggested and thought, “this
won’t be
too bad”. I downloaded the patch and tried to figure out what to patch.
Can
someone tell me which file I’m trying to patch? I’m assuming that I need
to
patch the corresponding file under gems. If so, I’ll need to change the
relative paths in the patch right? The patch is pointing to
actionpack/test/template/active_record_helper_test.rb and I don’t have
an
actionpack directory. I do have 2 versioned directories with the most
recent
being actionpack-1.11.2. I looked everywhere and I can’t find a good
reference on patching rails.

Can someone point me in the right direction?

View this message in context:
http://www.nabble.com/select_time-help-needed-(Noob)-t1268227.html#a3384661
Sent from the RubyOnRails Users forum at Nabble.com.