Skip to content

Commit

Permalink
Merge pull request rails#32302 from q-centrix/perf-improvement-tag-name
Browse files Browse the repository at this point in the history
Interpolate '' instead of nil when multiple is false.
  • Loading branch information
pixeltrix authored Mar 20, 2018
2 parents 7f71a6a + 8e095d6 commit c7cbc2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions actionview/lib/action_view/helpers/tags/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def tag_name(multiple = false, index = nil)
# a little duplication to construct less strings
case
when @object_name.empty?
"#{sanitized_method_name}#{"[]" if multiple}"
"#{sanitized_method_name}#{multiple ? "[]" : ""}"
when index
"#{@object_name}[#{index}][#{sanitized_method_name}]#{"[]" if multiple}"
"#{@object_name}[#{index}][#{sanitized_method_name}]#{multiple ? "[]" : ""}"
else
"#{@object_name}[#{sanitized_method_name}]#{"[]" if multiple}"
"#{@object_name}[#{sanitized_method_name}]#{multiple ? "[]" : ""}"
end
end

Expand Down

0 comments on commit c7cbc2e

Please sign in to comment.