mbasset / project_overview

Adds a new project overview page to redmine 2+.
MIT License
13 stars 9 forks source link

If has subproject, the project_overview shows internal error. #22

Open amizhang opened 8 years ago

amizhang commented 8 years ago

When a project has a subproject, the project_overview page can't be opened, the log show like:

ActionView::Template::Error (undefined method shift' for #<Project::ActiveRecord_Relation:0x00000102a35cc0>): 23: <% end %> 24: 25: <tr class="po_project"> 26: <td title="<%= project_full_title(project) %>"><%= link_to project.name, project_path(project) %></td> 27: <% if Setting.plugin_project_overview[:stale_enable] %> 28: <td align="center"> 29: <% if project.archived? %> app/views/common/_tabs.html.erb:22:inblock in _app_views_commontabs_html_erb3504873109440660110_2220811220' app/views/common/_tabs.html.erb:21:in each' app/views/common/_tabs.html.erb:21:in_app_views_commontabs_html_erb3504873109440660110_2220811220' app/helpers/application_helper.rb:321:in `render_tabs'

Found it this morning, still running on solutions.

amizhang commented 8 years ago

The simplest way is to add condition while get project name list:

Change _settings_project.html.erb, line 74

<%= select_tag("settings[exclude_projects]", options_from_collection_for_select(Project.active.where(:parent_id=>nil).order("name ASC"), :id, :name, Setting.plugin_project_overview[:exclude_projects]), { :multiple=> true, :style => "height: 300px;" }) %>
jancybsec commented 8 years ago

I just managed to run the plugin with open sub-projects, you can use the Rails gem activerecord-deprecated_finders as described in #19.