Defect #25337

Redmine patch for Rails breaks functionality of select_tag

Added by Stephan Wiehr over 5 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Rails support
Target version:-
Resolution: Affected version:3.3.2

Description

The Redmine patch in config/initializers/10-patches.rb breaks the functionality of ActionView::Helpers::FormTagHelper::select_tag, which states in the Rails documentation:

:include_blank - If set to true, an empty option will be created. If set to a string, the string will be used as the option’s content and the value will be empty.
[...]
select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: "All" 
# => <select id="people" name="people"><option value="">All</option><option value="1">David</option></select>

With the patch a string value given for :include_blank is not taken into account for the resulting option which will be &nbsp; unless the option :prompt is given.
This means the above example will result in

select_tag "people", options_from_collection_for_select(@people, "id", "name"), include_blank: "All" 
# => <select id="people" name="people"><option value="">&nbsp;</option><option value="1">David</option></select>

PS: I did not check but this is possibly similar for the other patches trying to correct the invalid <option value=""></option>

My Redmine environment:
  • Redmine version 3.3.2.stable.16377
  • Ruby version 2.3.1-p112 (2016-04-26) [x86_64-linux-gnu]
  • Rails version 4.2.7.1
  • Environment production
  • Database adapter Mysql2

Also available in: Atom PDF