From c25a079be25cc0aadf85119d97d8e1b9395b15fb Mon Sep 17 00:00:00 2001 From: David Gay Date: Thu, 20 May 2021 18:25:35 -0400 Subject: Add uniqueness scope constraint to BuiltHearthAmenity --- app/models/built_hearth_amenity.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/models/built_hearth_amenity.rb b/app/models/built_hearth_amenity.rb index c4d5a53..5ae8a42 100644 --- a/app/models/built_hearth_amenity.rb +++ b/app/models/built_hearth_amenity.rb @@ -1,4 +1,6 @@ class BuiltHearthAmenity < ApplicationRecord belongs_to :hearth belongs_to :hearth_amenity + + validates :hearth_id, uniqueness: { scope: :hearth_amenity_id } end -- cgit v1.2.3