mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:53:55 +08:00
Merge pull request #2173 from vikhyat/badge-system
Forgot to specify "dependent: destroy" for UserBadges
This commit is contained in:
commit
4191972afe
|
@ -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