Is there a good time_select tag helper?

I’m trying to record a list of start and end times, and they’re simply
an hour and a minute. Looking at the API, there’s a select_time
helper, but that just creates the tag. There’s a datetime_select
helper which takes an object and method name, so it does all the
magic…but I only want to worry about the hour and the minute. I’ve
tried writing my own so far and have not been able to figure anything
out. Does anyone have code for a time_select helper that does the
magic of filling in the fields and everything?

Pat

I happened to have a plugin laying around to accomplish this.

http://www.railtie.net/plugins/time_select.zip

Enjoy.

Bob

And usage info:

<%= time_select ‘model’, ‘field’ %>

It works by modifying the date_select function to output the date fields
as
hidden fields. This allows Rails to properly convert it to a datetime
assuming your database will handle the conversion from a datetime to a
time
value. (MySQL does)

Bob S.
http://www.railtie.net/

Hey Bob,

This worked great, thanks a lot.

Pat

I just downloaded this, and tried to install it, but, I get a plugin not
found error.

I extracted the files from the zip and ran:

ruby script/plugin install ‘path to time_select’, and I always get a not
found.

Any ideas.

Thanks in Advance.

M.

Bob S. wrote:

I happened to have a plugin laying around to accomplish this.

http://www.railtie.net/plugins/time_select.zip

Enjoy.

Bob

On 5/24/06, Guest [email protected] wrote:

I just downloaded this, and tried to install it, but, I get a plugin not
found error.

I extracted the files from the zip

Just put the time_select folder in vendor/plugins

Pat

Bob S. wrote:

I happened to have a plugin laying around to accomplish this.

http://www.railtie.net/plugins/time_select.zip

Enjoy.

Bob

This worked great for me (1.1.6) until I switched over to edge. Anyone
know how to get it running on edge? Or another plugin with the same
functionality?

Brad

This worked great for me (1.1.6) until I switched over to edge. Anyone
know how to get it running on edge? Or another plugin with the same
functionality?

I should add that I’m getting this error:
/vendor/plugins/time_select/lib/time_select.rb:16:in `value’: wrong
number of arguments (0 for 1)

Oops. I figured I had to install it like other plugings.

:blush:

Thanks Pat!

Pat M. wrote:

On 5/24/06, Guest [email protected] wrote:

I just downloaded this, and tried to install it, but, I get a plugin not
found error.

I extracted the files from the zip

Just put the time_select folder in vendor/plugins

Pat

Brad Adams wrote:

This worked great for me (1.1.6) until I switched over to edge. Anyone
know how to get it running on edge? Or another plugin with the same
functionality?

I should add that I’m getting this error:
/vendor/plugins/time_select/lib/time_select.rb:16:in `value’: wrong
number of arguments (0 for 1)

This did the trick.

I changed this line in the plugin
datetime = options[:include_blank] ? (value || nil) : (value ||
Time.now)
to
datetime = options[:include_blank] ? (value(object) || nil) :
(value(object) || Time.now)

Hope that helps anyone else going through the upgrade to edge.