#36 ✓resolved
Ben Mabey

Add selects_time helper

Reported by Ben Mabey | November 13th, 2008 @ 11:47 PM

This ticket is being motivated by this thread:


Basically, it would be nice to be able to take advantage of rails' datetime_helper conventions and provide a webrat helper that could take a string of time or time object and select all the appropriate fields.

I have done something like this before so I decided to make the patch. The patch isn't quite ready but you can see the progress in my remote branch:


I plan on making a select_date as well, and perhaps move things around a bit before it is done.

Comments and changes to this ticket

  • Ben Mabey

    Ben Mabey November 15th, 2008 @ 04:39 PM

    Ok, selects_time, selects_date, and selects_datetime are all added along with some documentation:


    Let me know how it looks and if you would want me to change anything about it. While I made the rail's convention the default I made it flexible enough for most any app and also easy to add future conventions (like merb perhaps.)

  • Bryan Helmkamp

    Bryan Helmkamp November 16th, 2008 @ 06:48 PM

    • State changed from “new” to “open”

    Hey Ben,

    Nice work. I've merged this in.

    Do you have a need for the id_prefix, suffixes, and/or suffix_convention options right now? If not, I'm wondering if it's worth leaving out the options in favor of simplicity in the first pass of this functionality.



  • Ben Mabey

    Ben Mabey November 16th, 2008 @ 07:02 PM

    Hey Bryan, I personally don't need the flexibility the suffix conventions provide but that is because I am generally using Rails and AR. I felt like the extra flexibility/complexity could be justified however since werbrat and cucumber seem to be getting traction in the merb community as well. I didn't know if Datamapper followed the same convention as rails when it came to multi-parameter attributes, so I decided to make it easy to change if it wasn't. If the rails convention made more sense I probably wouldn't of bothered but naming them 1i, 2i, etc, didn't seem to be too natural of a convention to assume other frameworks to take...

    That said I wouldn't be opposed at all if you wanted to remove those options to make it simpler.


  • Bryan Helmkamp

    Bryan Helmkamp November 16th, 2008 @ 07:15 PM

    I agree the Rails convention is somewhat odd. I did some research and it appears that Merb doesn't have any similar way to select dates and times (using multiple select boxes).

    Based on that, I'm going to remove the :suffixes and :suffix_convention options for now, and would gladly add them or something else back in to better accommodate Merb if they end up adding something similar to Rails. I'll make sure the docs state they are only likely to be useful for forms generated by Rails helpers.



  • Bryan Helmkamp

    Bryan Helmkamp November 16th, 2008 @ 07:33 PM

    • State changed from “open” to “resolved”

    I made the changes described in my previous comment. Marking this as fixed.

    Thanks again, Ben. I'm glad to get this feature into Webrat.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket