1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

adds minus to value part of id [#4862 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
RainerBlessing 2010-06-17 20:12:19 +02:00 committed by José Valim
parent dcfb9805f2
commit 70c932f794

View file

@ -1031,7 +1031,7 @@ module ActionView
private
def add_default_name_and_id_for_value(tag_value, options)
unless tag_value.nil?
pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/[^-\w]/, "").downcase
specified_id = options["id"]
add_default_name_and_id(options)
options["id"] += "_#{pretty_tag_value}" if specified_id.blank? && options["id"].present?