From 8bef78420992d14345c53e397b0c2d99c8ebf2c5 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 15:16:26 -0500 Subject: [PATCH 1/2] Order leader skills alphabetically --- app/models/leader_skill.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/leader_skill.rb b/app/models/leader_skill.rb index 07c4d64..50dffb5 100644 --- a/app/models/leader_skill.rb +++ b/app/models/leader_skill.rb @@ -3,4 +3,6 @@ class LeaderSkill < ActiveRecord::Base validates :description, presence: true, uniqueness: { case_sensitive: false } + + default_scope { order(:description) } end From cd7e8f736f726243daf96cc7c3a67079fc72c142 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 3 Nov 2015 15:29:10 -0500 Subject: [PATCH 2/2] Allow unnamed passive skills --- app/models/passive_skill.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/passive_skill.rb b/app/models/passive_skill.rb index fa07c6f..dd1b956 100644 --- a/app/models/passive_skill.rb +++ b/app/models/passive_skill.rb @@ -1,13 +1,16 @@ class PassiveSkill < ActiveRecord::Base has_paper_trail - validates :name, presence: true validates :description, presence: true, uniqueness: { scope: :name } default_scope { order(:name) } def full - "#{name} - #{description}" + "#{display_name} - #{description}" + end + + def display_name + name.present? ? name : 'UNNAMED' end end