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?
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)
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?
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 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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.