mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
Specify dependent: destroy
for UserBadges.
This commit is contained in:
parent
36cbd0d348
commit
b1e524e9c3
@ -1,5 +1,6 @@
|
||||
class Badge < ActiveRecord::Base
|
||||
belongs_to :badge_type
|
||||
has_many :user_badges, dependent: :destroy
|
||||
|
||||
validates :name, presence: true, uniqueness: true
|
||||
validates :badge_type, presence: true
|
||||
|
@ -4,6 +4,7 @@ require_dependency 'badge'
|
||||
describe Badge do
|
||||
|
||||
it { should belong_to :badge_type }
|
||||
it { should have_many(:user_badges).dependent(:destroy) }
|
||||
|
||||
context 'validations' do
|
||||
before(:each) { Fabricate(:badge) }
|
||||
|
Loading…
Reference in New Issue
Block a user