From 860f58b97437a18c304304fd4449bc34e0eeeb68 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 23 Oct 2015 10:57:22 -0400 Subject: [PATCH 1/3] Require leader skills to be unique --- app/models/leader_skill.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/leader_skill.rb b/app/models/leader_skill.rb index 3a493af..07c4d64 100644 --- a/app/models/leader_skill.rb +++ b/app/models/leader_skill.rb @@ -1,5 +1,6 @@ class LeaderSkill < ActiveRecord::Base has_paper_trail - validates :description, presence: true + validates :description, presence: true, + uniqueness: { case_sensitive: false } end From f5f91f0ff9cddc10ec90c2163a618352460e1bf5 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 23 Oct 2015 11:21:26 -0400 Subject: [PATCH 2/3] Super Attack name + description should be unique --- app/models/super_attack.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/super_attack.rb b/app/models/super_attack.rb index 332c480..ad32ec1 100644 --- a/app/models/super_attack.rb +++ b/app/models/super_attack.rb @@ -2,7 +2,8 @@ class SuperAttack < ActiveRecord::Base has_paper_trail validates :name, presence: true - validates :description, presence: true + validates :description, presence: true, + uniqueness: { scope: :name } default_scope { order(:name) } From 23796373f081c9060c875ba42b02d82efe9f127e Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 23 Oct 2015 11:27:15 -0400 Subject: [PATCH 3/3] Uniqueness constraint on passive skill --- app/models/passive_skill.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/passive_skill.rb b/app/models/passive_skill.rb index 6eebdbc..835e035 100644 --- a/app/models/passive_skill.rb +++ b/app/models/passive_skill.rb @@ -2,7 +2,8 @@ class PassiveSkill < ActiveRecord::Base has_paper_trail validates :name, presence: true - validates :description, presence: true + validates :description, presence: true, + uniqueness: { scope: :name } default_scope { order(:name) } end