Defect #16645

undefined method `>' for nil:NilClass

Added by Alexander Klevtsov almost 8 years ago. Updated over 7 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Custom fields
Target version:-
Resolution:Cant reproduce Affected version:2.4.5

Description

After upgrade from 2.4-dev to 2.4.5 started in some projects encounter errors:
undefined method `>' for nil:NilClass

   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 1 LIMIT 1
  Current user: kaa (id=1)
  Project Load (0.1ms)  SELECT `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'olis-lxg-travel' LIMIT 1
  SQL (0.1ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 39
  IssueStatus Load (0.1ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  IssuePriority Load (0.1ms)  SELECT `enumerations`.* FROM `enumerations` WHERE `enumerations`.`type` IN ('IssuePriority') AND `enumerations`.`is_default` = 1 ORDER BY enumerations.position ASC LIMIT 1
  Project Load (0.1ms)  SELECT `projects`.* FROM `projects` WHERE `projects`.`id` = 39 LIMIT 1
  Tracker Load (0.2ms)  SELECT `trackers`.* FROM `trackers` INNER JOIN `projects_trackers` ON `trackers`.`id` = `projects_trackers`.`tracker_id` WHERE `projects_trackers`.`project_id` = 39 AND `trackers`.`id` = 1 ORDER BY trackers.position LIMIT 1
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  Role Load (0.1ms)  SELECT `roles`.* FROM `roles` 
  WorkflowTransition Load (0.1ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowTransition') AND `workflows`.`old_status_id` = 1 AND (role_id IN (1,2,3,4,5,6,7,8) AND tracker_id = 1 AND ((author = 0 AND assignee = 0) OR author = 1))
  IssueStatus Load (0.1ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`id` IN (5, 4, 3, 2, 6)
  SQL (0.1ms)  SELECT `enabled_modules`.`name` FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 39
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  WorkflowPermission Load (0.1ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowPermission') AND `workflows`.`tracker_id` = 1 AND `workflows`.`old_status_id` = 1 AND `workflows`.`role_id` IN (1, 2, 3, 4, 5, 6, 7, 8)
  Tracker Load (0.2ms)  SELECT `trackers`.* FROM `trackers` WHERE `trackers`.`id` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowPermission') AND `workflows`.`tracker_id` = 1 AND `workflows`.`old_status_id` = 1 AND `workflows`.`role_id` IN (1, 2, 3, 4, 5, 6, 7, 8)
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowTransition') AND `workflows`.`old_status_id` = 1 AND (role_id IN (1,2,3,4,5,6,7,8) AND tracker_id = 1 AND ((author = 0 AND assignee = 0) OR author = 1))
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`id` IN (5, 4, 3, 2, 6)
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowTransition') AND `workflows`.`old_status_id` = 1 AND (role_id IN (1,2,3,4,5,6,7,8) AND tracker_id = 1 AND ((author = 0 AND assignee = 0) OR author = 1))
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`id` IN (5, 4, 3, 2, 6)
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowPermission') AND `workflows`.`tracker_id` = 1 AND `workflows`.`old_status_id` = 1 AND `workflows`.`role_id` IN (1, 2, 3, 4, 5, 6, 7, 8)
  IssueCustomField Load (0.2ms)  SELECT `custom_fields`.* FROM `custom_fields` INNER JOIN `custom_fields_trackers` ON `custom_fields`.`id` = `custom_fields_trackers`.`custom_field_id` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND `custom_fields_trackers`.`tracker_id` = 1
  IssueCustomField Load (0.1ms)  SELECT `custom_fields`.* FROM `custom_fields` WHERE `custom_fields`.`type` IN ('IssueCustomField') AND (is_for_all = 1 OR id IN (SELECT DISTINCT cfp.custom_field_id FROM custom_fields_projects cfp WHERE cfp.project_id = 39)) ORDER BY custom_fields.position ASC
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowPermission') AND `workflows`.`tracker_id` = 1 AND `workflows`.`old_status_id` = 1 AND `workflows`.`role_id` IN (1, 2, 3, 4, 5, 6, 7, 8)
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowPermission') AND `workflows`.`tracker_id` = 1 AND `workflows`.`old_status_id` = 1 AND `workflows`.`role_id` IN (1, 2, 3, 4, 5, 6, 7, 8)
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` 
  CACHE (0.0ms)  SELECT `workflows`.* FROM `workflows` WHERE `workflows`.`type` IN ('WorkflowTransition') AND `workflows`.`old_status_id` = 1 AND (role_id IN (1,2,3,4,5,6,7,8) AND tracker_id = 1 AND ((author = 0 AND assignee = 0) OR author = 1))
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`id` IN (5, 4, 3, 2, 6)
  CACHE (0.0ms)  SELECT `issue_statuses`.* FROM `issue_statuses` WHERE `issue_statuses`.`is_default` = 1 LIMIT 1
  User Load (0.2ms)  SELECT DISTINCT `users`.* FROM `users` INNER JOIN `members` ON `members`.`user_id` = `users`.`id` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND (members.project_id = 39)
   (0.1ms)  BEGIN
   (0.0ms)  ROLLBACK
Completed 500 Internal Server Error in 273.3ms

NoMethodError (undefined method `>' for nil:NilClass):
  app/models/custom_field.rb:355:in `validate_field_value_format'
  app/models/custom_field.rb:334:in `validate_field_value'
  app/models/custom_field_value.rb:46:in `validate_value'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:126:in `each'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:126:in `validate_custom_field_values'
  app/controllers/issues_controller.rb:146:in `create'

Environment:
  Redmine version                2.4.5.stable
  Ruby version                   2.0.0-p451 (2014-02-24) [i686-linux]
  Rails version                  3.2.17
  Environment                    development
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.12
  Cvs                            1.12.13
  Git                            1.7.2.5
  Filesystem                     
Redmine plugins:
  recaptcha                      1.0.0
  redmine_agile                  1.1.2-light
  redmine_people                 0.1.8
  redmine_questions              0.0.5

History

#1 Updated by Toshi MARUYAMA almost 8 years ago

  • Status changed from New to Closed
  • Resolution set to Cant reproduce

Please contact plugin author.
It seems one of your plugins overrides CustomField#validate_field_value_format or sets min_length null.

#2 Updated by Johan Guilbaud over 7 years ago

I got same error as above but i don't have same plugin or plugin redefining this method

Environment:
  Redmine version                2.4.2.stable (with some official patches)
  Ruby version                   2.1.0-p0 (2013-12-25) [x86_64-linux]
  Rails version                  3.2.16
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.8
  Filesystem                     
Redmine plugins:
  redmine_charts2                0.2.1
  redmine_wiki_unc               0.0.3

#3 Updated by Alexander Klevtsov over 7 years ago

Update your redmine to last 2.5 version.
Error was at some migration database scripts.

Also available in: Atom PDF