Patch #6761
closed
Use blank?/present? methods instead of empty? to avoid nil undefined method errors
Added by Jean-Baptiste Barth about 14 years ago.
Updated over 13 years ago.
Category:
Code cleanup/refactoring
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...
- 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.
- 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...
Also available in: Atom
PDF