Apply automatic rubocop fixes
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
class Tag < ApplicationRecord
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Tag < ApplicationRecord
|
||||
has_many :exercise_tags
|
||||
has_many :exercises, through: :exercise_tags
|
||||
|
||||
validates_uniqueness_of :name
|
||||
validates :name, uniqueness: true
|
||||
|
||||
def destroy
|
||||
if (can_be_destroyed?)
|
||||
if can_be_destroyed?
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def can_be_destroyed?
|
||||
!exercises.any?
|
||||
exercises.none?
|
||||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user