diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-01 02:45:56 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-17 18:58:57 +0300 |
commit | 252e93c9e664e595ea9b4987f14ca8fb21a0e307 (patch) | |
tree | 2d62339b792ac429520e1fe037b09650b2fc6925 /app/models/list.rb | |
parent | b07c5f23b8761ae87d29ded1a69b14ae6393443a (diff) |
Title of a list is either the label name, or Backlog, or Done
Diffstat (limited to 'app/models/list.rb')
-rw-r--r-- | app/models/list.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/list.rb b/app/models/list.rb index 38cf2050527..b4fdab7893a 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -7,4 +7,10 @@ class List < ActiveRecord::Base validates :board, :list_type, presence: true validates :label, :position, presence: true, if: :label? validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :label? + + delegate :name, to: :label, allow_nil: true, prefix: true + + def title + label? ? label_name : list_type.humanize + end end |