aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/results_controller.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-01-04 00:02:21 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-01-04 00:02:21 +0900
commit09116c1ab91677f950b7e4795d7a31324253be6d (patch)
tree49a5302b7eda3d32c057b0ee0d0e85a54b13c68a /app/controllers/results_controller.rb
parentad5967a256dfefe5191013b56f1fc37fdb87e33c (diff)
downloadpoe-09116c1ab91677f950b7e4795d7a31324253be6d.tar.gz
🔪
Diffstat (limited to 'app/controllers/results_controller.rb')
-rw-r--r--app/controllers/results_controller.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/results_controller.rb b/app/controllers/results_controller.rb
new file mode 100644
index 0000000..60ade5a
--- /dev/null
+++ b/app/controllers/results_controller.rb
@@ -0,0 +1,20 @@
+class ResultsController < ApplicationController
+ before_action :set_result, only: [:show]
+
+ def run
+ compiler = Compiler.find(params[:compiler_id])
+ snippet = Snippet.find(params[:snippet_id])
+ @result = compiler.run(snippet)
+
+ show
+ end
+
+ def show
+ render text: render_to_string(partial: "results/result", locals: { result: @result, compiler: @result.compiler }), content_type: "text/plain"
+ end
+
+ private
+ def set_result
+ @result = Result.find(params[:id])
+ end
+end