Apply automatic rubocop fixes

This commit is contained in:
Sebastian Serth
2021-05-14 10:51:44 +02:00
parent fe4000916c
commit 6cbecb5b39
440 changed files with 2705 additions and 1853 deletions

View File

@@ -6,11 +6,16 @@ class Tip < ApplicationRecord
has_many :exercise_tips
has_many :exercises, through: :exercise_tips
belongs_to :file_type, optional: true
validates_presence_of :file_type, if: :example?
validates :file_type, presence: {if: :example?}
validate :content?
def content?
errors.add :description, I18n.t('activerecord.errors.messages.at_least', attribute: I18n.t('activerecord.attributes.tip.example')) unless [description?, example?].include?(true)
unless [
description?, example?
].include?(true)
errors.add :description,
I18n.t('activerecord.errors.messages.at_least', attribute: I18n.t('activerecord.attributes.tip.example'))
end
end
def to_s