Project

General

Profile

Actions

Patch #6761

closed

Use blank?/present? methods instead of empty? to avoid nil undefined method errors

Added by Jean-Baptiste Barth over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
-
Start date:
2010-10-27
Due date:
% Done:

0%

Estimated time:

Description

Discussed in #6750, I think it would be a good practice to avoid the well known "undefined method error for nil:NilClass". Plus it would make some views clearer...

Actions #1

Updated by Jean-Philippe Lang over 13 years ago

  • Target version changed from 1.1.0 to Unplanned backlogs

I think it makes sense especially in views, but it can sometimes make the code less easy to read. So I'm not very inclined to replace every empty?/any? with blank?/present?.
Something to keep in mind and maybe to add to the coding standards.

Actions #2

Updated by Jean-Baptiste Barth almost 13 years ago

  • Status changed from 7 to Closed
  • Target version deleted (Unplanned backlogs)

Agreed, let's keep it in mind every time we change a view. I added it to CodingStandards but as long as it's not complete and official, it might not be that useful...

Actions

Also available in: Atom PDF