diff options
Diffstat (limited to 'app/models/tracker.rb')
-rw-r--r-- | app/models/tracker.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/tracker.rb b/app/models/tracker.rb index 472b94b31..9b3f6afe6 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -92,12 +92,20 @@ class Tracker < ActiveRecord::Base # Returns the fields that are disabled for all the given trackers def self.disabled_core_fields(trackers) - trackers.uniq.map(&:disabled_core_fields).reduce(:&) + if trackers.present? + trackers.uniq.map(&:disabled_core_fields).reduce(:&) + else + [] + end end # Returns the fields that are enabled for one tracker at least def self.core_fields(trackers) - trackers.uniq.map(&:core_fields).reduce(:|) + if trackers.present? + trackers.uniq.map(&:core_fields).reduce(:|) + else + CORE_FIELDS.dup + end end private |