diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2887226a..593b5a4cc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -205,7 +205,12 @@ module ApplicationHelper s = '' project_tree(projects) do |project, level| name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '') - tag_options = {:value => project.id, :selected => ((project == options[:selected]) ? 'selected' : nil)} + tag_options = {:value => project.id} + if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) + tag_options[:selected] = 'selected' + else + tag_options[:selected] = nil + end tag_options.merge!(yield(project)) if block_given? s << content_tag('option', name_prefix + h(project), tag_options) end