Canadian Provinces Form Helper for Rails

Wednesday, December 27

I live and work in Canada. It follows, then, that I often need to generate a select box for Canadian provinces, especially for my work at Unspace. Jealous of the built-in helper for Rails that implements country selection, I whipped up a simple plugin.

All it does is extend ActionView::Helpers::FormOptionsHelper adding the methods province_select, and province_options_for_select.

Get it from subversion via: svn://visioni.st/p/canadian_provinces

And yes, it includes tests.

Comments

Leave a response

  1. Akhil BansalJanuary 24, 2007 @ 02:09 AM

    I have also published a plugin(state_select). That generates the selection box for the states in the country specified. Usage: state_select(object, method, country=’US’, options = {}, html_options = {}) or state_options_for_select(selected = nil, country = ‘US’)

    Curently it can generate state list for India, US, Canada, Australia and Spain(default is US).

    visit http://webonrails.com/2006/09/12/plugin-state_select-generate-drop-down-selection-box-for-states/ for details

  2. PackagethiefJanuary 28, 2007 @ 03:23 PM

    Akhil, very cool. I wish I had been aware of your plugin before I made this one. I’ll definately check yours out.. thanks for the heads up!

  3. NicoleFebruary 25, 2007 @ 06:39 PM

    Man you don’t even know how long I’ve waited for this since disabling my own Movable Type widget (that doesn’t work since Haloscan bypasses that code).