Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/models/exercise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ def before_publication
end
end

protected

def has_questions
return unless questions.first.nil?
errors.add(:questions, "can't be blank")
Expand Down
4 changes: 2 additions & 2 deletions db/migrate/20220302162344_create_slug_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class CreateSlugTags < ActiveRecord::Migration[6.1]
def up
Exercise.preload(:publication).in_batches(of: 100, load: true) do |exercises|
Exercise.transaction do
exercises.each(&:save) # creates the slug tags but does not set updated_at
exercises.update_all(updated_at: Time.current) # invalidates the exercise cache
exercises.each(&:set_slug_tags)
exercises.update_all updated_at: Time.current
end
end
end
Expand Down