Files
codeocean/app/models/application_record.rb
Sebastian Serth 5ecba6ef70 Persist TestrunMessages and store timestamp
So far, the Testrun messages are in addition to the Tesstrun.output column
2022-04-29 01:00:51 +02:00

19 lines
549 B
Ruby

# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
before_validation :strip_strings
def strip_strings
# trim whitespace from beginning and end of string attributes
# except for the `content` of CodeOcean::Files
# and except the `log` of TestrunMessages or the `output` of Testruns
attribute_names.without('content', 'log', 'output').each do |name|
if send(name.to_sym).respond_to?(:strip)
send("#{name}=".to_sym, send(name).strip)
end
end
end
end