Project

General

Profile

Actions

Defect #13495

closed

Rendering of multi-select custom fields User and Version produces error

Added by Dipan Mehta about 11 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I created a custom field on Project - which is of type "User" and is multi-select.
Upon editing the values the project page doesn't throws internal server error -500.

The single user field works fine on the same project.

Here is the log:

Processing by VersionsController#show as HTML
  Parameters: {"id"=>"196"}
  ^[[1m^[[35m (0.2ms)^[[0m  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings`
  ^[[1m^[[36mUser Load (0.2ms)^[[0m  ^[[1mSELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 1 AND (users.status = 1) LIMIT 1^[[0m
  Current user: admin (id=1)
  ^[[1m^[[35mVersion Load (0.2ms)^[[0m  SELECT `versions`.* FROM `versions` WHERE `versions`.`id` = 196 LIMIT 1
  ^[[1m^[[36mProject Load (0.2ms)^[[0m  ^[[1mSELECT `projects`.* FROM `projects` WHERE `projects`.`id` = 32 LIMIT 1^[[0m
  ^[[1m^[[35mEnabledModule Load (0.2ms)^[[0m  SELECT name FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 32
  ^[[1m^[[36mSQL (0.5ms)^[[0m  ^[[1mSELECT `issues`.`id` AS t0_r0, `issues`.`tracker_id` AS t0_r1, `issues`.`project_id` AS t0_r2, `issues`.`subject` AS t0_r3, `issues`.`description` AS t0_r4, `issues`.`due_date` AS t0_r5, `issues`.`category_id` AS t0_r6, `issues`.`status_id` AS t0_r7, `issues`.`assigned_to_id` AS t0_r8, `issues`.`priority_id` AS t0_r9, `issues`.`fixed_version_id` AS t0_r10, `issues`.`author_id` AS t0_r11, `issues`.`lock_version` AS t0_r12, `issues`.`created_on` AS t0_r13, `issues`.`updated_on` AS t0_r14, `issues`.`start_date` AS t0_r15, `issues`.`done_ratio` AS t0_r16, `issues`.`estimated_hours` AS t0_r17, `issues`.`parent_id` AS t0_r18, `issues`.`root_id` AS t0_r19, `issues`.`lft` AS t0_r20, `issues`.`rgt` AS t0_r21, `issues`.`is_private` AS t0_r22, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `projects`.`default_assignee_id` AS t1_r12, `projects`.`default_version_id` AS t1_r13, `issue_statuses`.`id` AS t2_r0, `issue_statuses`.`name` AS t2_r1, `issue_statuses`.`is_closed` AS t2_r2, `issue_statuses`.`is_default` AS t2_r3, `issue_statuses`.`position` AS t2_r4, `issue_statuses`.`default_done_ratio` AS t2_r5, `trackers`.`id` AS t3_r0, `trackers`.`name` AS t3_r1, `trackers`.`is_in_chlog` AS t3_r2, `trackers`.`position` AS t3_r3, `trackers`.`is_in_roadmap` AS t3_r4, `trackers`.`fields_bits` AS t3_r5, `enumerations`.`id` AS t4_r0, `enumerations`.`name` AS t4_r1, `enumerations`.`position` AS t4_r2, `enumerations`.`is_default` AS t4_r3, `enumerations`.`type` AS t4_r4, `enumerations`.`active` AS t4_r5, `enumerations`.`project_id` AS t4_r6, `enumerations`.`parent_id` AS t4_r7, `enumerations`.`position_name` AS t4_r8 FROM `issues` LEFT OUTER JOIN `projects` ON `projects`.`id` = `issues`.`project_id` LEFT OUTER JOIN `issue_statuses` ON `issue_statuses`.`id` = `issues`.`status_id` LEFT OUTER JOIN `trackers` ON `trackers`.`id` = `issues`.`tracker_id` LEFT OUTER JOIN `enumerations` ON `enumerations`.`id` = `issues`.`priority_id` AND `enumerations`.`type` IN ('IssuePriority') WHERE `issues`.`fixed_version_id` = 196 AND (projects.status <> 9 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) ORDER BY trackers.position, issues.id^[[0m
  ^[[1m^[[36mSQL (1.5ms)^[[0m  ^[[1mSELECT `custom_values`.`id` AS t0_r0, `custom_values`.`customized_type` AS t0_r1, `custom_values`.`customized_id` AS t0_r2, `custom_values`.`custom_field_id` AS t0_r3, `custom_values`.`value` AS t0_r4, `custom_fields`.`id` AS t1_r0, `custom_fields`.`type` AS t1_r1, `custom_fields`.`name` AS t1_r2, `custom_fields`.`field_format` AS t1_r3, `custom_fields`.`possible_values` AS t1_r4, `custom_fields`.`regexp` AS t1_r5, `custom_fields`.`min_length` AS t1_r6, `custom_fields`.`max_length` AS t1_r7, `custom_fields`.`is_required` AS t1_r8, `custom_fields`.`is_for_all` AS t1_r9, `custom_fields`.`is_filter` AS t1_r10, `custom_fields`.`position` AS t1_r11, `custom_fields`.`searchable` AS t1_r12, `custom_fields`.`default_value` AS t1_r13, `custom_fields`.`editable` AS t1_r14, `custom_fields`.`visible` AS t1_r15, `custom_fields`.`multiple` AS t1_r16, `custom_fields`.`textilizable` AS t1_r17, `custom_fields`.`is_for_new` AS t1_r18, `custom_fields`.`hint` AS t1_r19 FROM `custom_values` LEFT OUTER JOIN `custom_fields` ON `custom_fields`.`id` = `custom_values`.`custom_field_id` WHERE `custom_values`.`customized_id` = 196 AND `custom_values`.`customized_type` = 'Version' ORDER BY custom_fields.position^[[0m
  Rendered versions/_overview.html.erb (36.3ms)
  Rendered versions/show.html.erb within layouts/base (40.3ms)
Completed 500 Internal Server Error in 98ms

ActionView::Template::Error (undefined method `to_i' for [nil]:Array):
    9: <ul>
    10:   <% version.custom_field_values.each do |custom_value| %>
    11:     <% if custom_value.value.present? %>
    12:        <li><%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %></li>
    13:     <% end %>
    14:   <% end %>
    15: </ul>
  lib/redmine/custom_field_format.rb:55:in `block (2 levels) in <class:CustomFieldFormat>'
  lib/redmine/custom_field_format.rb:36:in `format'
  lib/redmine/custom_field_format.rb:101:in `format_value'
  app/views/versions/_overview.html.erb:12:in `block in _app_views_versions__overview_html_erb__244901322_114847310'
  app/views/versions/_overview.html.erb:10:in `each'
  app/views/versions/_overview.html.erb:10:in `_app_views_versions__overview_html_erb__244901322_114847310'
  app/views/versions/show.html.erb:11:in `_app_views_versions_show_html_erb__900268706_113200580'

My environment is:
Ruby version 1.9.3 (i686-linux)
RubyGems version 1.8.25
Rack version 1.4
Rails version 3.2.12
Active Record version 3.2.12
Action Pack version 3.2.12
Active Resource version 3.2.12
Action Mailer version 3.2.12
Active Support version 3.2.12
Middleware Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0xa52f6ac>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication
Application root /usr/local/share/redmine-2.2.3
Environment production
Database adapter mysql2
Database schema version 20121026003537

Actions

Also available in: Atom PDF