Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #2991 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] Add :not_selected option to select form helper to not select model's current value

Reported by: jonathan@bluewire.net.nz Assigned to: Jeremy Kemper <rails@bitsweat.net>
Priority: normal Milestone: 1.1
Component: ActionPack Version: 0.14.3
Severity: minor Keywords: select helper
Cc:

Description

I had a situation today where I always wanted the user to select a new value in a dropdown box, and not display the current value.

This patch adds a :not_selected option to the select() form helper, which causes it not to add the selected="selected" attribute to the option tag for the model's current value.

Attachments

select_not_selected_option.diff (3.2 kB) - added by jonathan@bluewire.net.nz on 11/23/05 10:41:09.
Add :not_selected option to select() form helper (and test)

Change History

11/23/05 10:41:09 changed by jonathan@bluewire.net.nz

  • attachment select_not_selected_option.diff added.

Add :not_selected option to select() form helper (and test)

11/23/05 11:14:49 changed by anonymous

  • type changed from defect to enhancement.

11/23/05 21:57:18 changed by bitsweat

  • keywords set to select helper.
  • owner changed from David to bitsweat.
  • reporter changed from anonymous to jonathan@bluewire.net.nz.
  • milestone changed from 1.0 to 1.1.

Thanks! Modified a bit: pass :selected => nil for unselected.

11/23/05 21:59:24 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [3174]) Introduce :selected option to the select helper. Allows you to specify a selection other than the current value of object.method. Specify :selected => nil to leave all options unselected. Closes #2991.

11/23/05 22:59:50 changed by anonymous

Yep, that's a better way of doing it. I was a bit tired when I did it last night, realised this morning that it should be done the way you had already modified it to!