Add backend for tips and enable markdown support
This commit is contained in:
@@ -32,6 +32,10 @@ class FileType < ApplicationRecord
|
||||
end
|
||||
private :set_default_values
|
||||
|
||||
def programming_language
|
||||
editor_mode.gsub('ace/mode/', '')
|
||||
end
|
||||
|
||||
def to_s
|
||||
name
|
||||
end
|
||||
|
@@ -20,4 +20,9 @@ class Tip < ApplicationRecord
|
||||
"#{I18n.t('activerecord.models.tip.one')} #{id}"
|
||||
end
|
||||
end
|
||||
|
||||
def can_be_destroyed?
|
||||
# This tip can only be destroyed if it is no parent to any other exercise tip
|
||||
ExerciseTip.where(parent_exercise_tip: exercise_tips).none?
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user