Fix 404 on move experiment

[fixes SCI-378]
This commit is contained in:
Jure Grabnar 2016-08-24 11:09:03 +02:00
parent 5c8d669cac
commit 3e5e9aed22
2 changed files with 5 additions and 3 deletions

View file

@ -106,7 +106,7 @@ class ExperimentsController < ApplicationController
# POST: clone_experiment(id)
def clone
project = Project.find_by_id(params[:experiment][:project_id])
project = Project.find_by_id(params[:experiment].try(:[], :project_id))
# Try to clone the experiment
success = true
@ -157,7 +157,7 @@ class ExperimentsController < ApplicationController
# POST: move_experiment(id)
def move
project = Project.find_by_id(params[:experiment][:project_id])
project = Project.find_by_id(params[:experiment].try(:[], :project_id))
old_project = @experiment.project
# Try to move the experiment

View file

@ -25,7 +25,9 @@
<% end %>
</div>
<div class="modal-footer">
<%= f.submit t("experiments.move.modal_submit"), class: "btn btn-primary" %>
<% if !@projects.blank? %>
<%= f.submit t("experiments.move.modal_submit"), class: "btn btn-primary" %>
<% end %>
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
</div>
</div>