removed url helper from model

This commit is contained in:
Tom Staubitz
2017-01-18 13:35:18 +01:00
parent 721c11bf28
commit 59f2ff436e
2 changed files with 8 additions and 18 deletions

View File

@ -28,17 +28,6 @@ class Submission < ActiveRecord::Base
ancestors.merge(descendants).values
end
[:download_file, :render, :run, :test].each do |action|
filename = FILENAME_URL_PLACEHOLDER.gsub(/\W/, '')
define_method("#{action}_url") do
Rails.application.routes.url_helpers.send(:"#{action}_submission_path", self, filename).sub(filename, FILENAME_URL_PLACEHOLDER)
end
end
def download_url
Rails.application.routes.url_helpers.send(:download_submission_path, self)
end
def main_file
collect_files.detect(&:main_file?)
end
@ -56,12 +45,6 @@ class Submission < ActiveRecord::Base
(normalized_score * 100).round
end
[:score, :stop].each do |action|
define_method("#{action}_url") do
Rails.application.routes.url_helpers.send(:"#{action}_submission_path", self)
end
end
def siblings
user.submissions.where(exercise_id: exercise_id)
end