#22 new
bentlegen

escape_xml in Form::Builder.options breaks :selected matching for integers

Reported by bentlegen | December 30th, 2008 @ 08:46 PM

The escape_xml call in merb-helpers/form/builder.rb L251 (http://github.com/wycats/merb/tr...) forces each :collection element value to a string. This takes place before the :collection is matched against the :selected param, which could still be an integer. The result is that the following call:


options(
  [1,2,3,4,5].map{|i| [i]}, # collection
  nil,         # text_method
  nil,         # value_method
  3            # selected
)

Doesn't match the value 3. You need to do the following:


options(
  [1,2,3,4,5].map{|i| [i]},
  nil,
  nil,
  "3"  # !
)

I think this behaviour was introduced here:

http://github.com/wycats/merb/co...

No comments found

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 »

Shared Ticket Bins

People watching this ticket

Pages