app/controllers/tasks/accessions/quick/simple_controller.rb
Use id.presence || @specimen.try(:taxon_determinations).try(:first).try(:otu_id)
instead of if id.blank?
@specimen.try(:taxon_determinations).try(:first).try(:otu_id)
else
id
end
. Open
Open
if id.blank?
@specimen.try(:taxon_determinations).try(:first).try(:otu_id)
else
id
end
- Read upRead up
- Exclude checks
This cop checks code that can be written more easily using
Object#presence
defined by Active Support.
Example:
# bad
a.present? ? a : nil
# bad
!a.present? ? nil : a
# bad
a.blank? ? nil : a
# bad
!a.blank? ? a : nil
# good
a.presence
Example:
# bad
a.present? ? a : b
# bad
!a.present? ? b : a
# bad
a.blank? ? b : a
# bad
!a.blank? ? a : b
# good
a.presence || b
TODO found Open
Open
# TODO: move this to model!
- Exclude checks