This project is archived and is in readonly mode.

#1574 ✓wontfix
Andrew Kaspick

Allow custom month ordering for select_month

Reported by Andrew Kaspick | December 15th, 2008 @ 05:55 AM | in 2.x

Allow a custom month order to be specified for the select_month method. Useful when certain months should not be available for a particular scenario or a custom ordering is required.

Valid months for a school year for example could be Sept through June.

eg. :month_order => [2,3,4] only generates the select options for Feb, Mar, Apr in that order.

eg. :month_order => [11,12,1,2] only generates the select options for Nov, Dec, Jan, Feb in that order. - Useful for selecting months where a time period begins in one year and ends in another such as sport seasons, events and other schedules.

Comments and changes to this ticket

  • Yaroslav Markin

    Yaroslav Markin December 25th, 2008 @ 09:14 PM

    I believe you should use a custom selector for that scenario, no? select_month part of datetime is already a bit too bloated.

  • Andrew Kaspick

    Andrew Kaspick December 28th, 2008 @ 07:20 AM

    I've already had a need for this in 2 projects of mine, so I figure it may be useful for others and it's a pretty minor change. select_month doesn't seem overly bloated to me. (1..12) in the method is hard coded, so this just allows you to override that.

  • Michael Koziarski

    Michael Koziarski February 18th, 2009 @ 05:20 AM

    • State changed from “new” to “wontfix”

    I agree with yaroslav here. There's already a tonne of options to those helpers, and we'll never be able to satisfy everyone.

  • Andrew Kaspick

    Andrew Kaspick February 18th, 2009 @ 05:51 AM

    Fair enough, although...

    Less requests for custom options may occur if some of those month name related methods (the ones that give you "January","Jan",etc.) were more accessible for reuse, but right now they're all private and depend on the class var for the @options.

    I don't like copy and pasting rails methods that are more than a handful of lines long in order to customize them slightly as you then need to maintain them with each rails release. Using the existing select_month method gave me the month naming functionality "out of the box" which was a big benefit.

    On the path towards Rail 3, moving the month name methods to a more accessible spot for the "public" plugin/gem API may be something to consider.

    Thanks for reviewing anyway.

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket