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

Ticket #11499 (new defect)

Opened 1 month ago

Last modified 3 weeks ago

[PATCH] Format option of sortable_element helper should accept regexpes.

Reported by: infrared Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc:

Description

The documentation for format option of sortable_element helper says:

A regular expression to determine what to send as the serialized id to the server

but when you pass a Regexp it generates bogus JavaScript code.

Attached patch fixes this issue, by calling passed_regexp.inspect before embedding it inside the generated code.

Tests included. Patch against current trunk.

Attachments

regexp_support_for_format_option_of_sortable_element.diff (2.5 kB) - added by infrared on 04/01/08 20:23:12.

Change History

04/01/08 20:23:12 changed by infrared

  • attachment regexp_support_for_format_option_of_sortable_element.diff added.

04/25/08 19:27:42 changed by tpope

The subtle differences between Javascript and Ruby regexps makes me a bit hesitant to recommend this. But the differences mostly don't matter in this context, it's an improvement over the old behavior, and one can always still choose to use a string. +1