Rails表单提交给控制器操作和jQuery模式

Rails表单提交给控制器操作和jQuery模式,jquery,ruby-on-rails,forms,ruby-on-rails-4,modal-dialog,Jquery,Ruby On Rails,Forms,Ruby On Rails 4,Modal Dialog,我希望表单在控制器中提交(发布)一个自定义操作,该操作将执行评估(基于表单中的数据),然后弹出一个包含评估结果的jQuery模型。诀窍是,我想让这个模式在表单上弹出,这样如果他们关闭模式,就可以返回并查看/编辑表单 我试过下面这样的方法,但不起作用。我得到以下错误: 缺少模板游戏/评估,使用{:locale=>[:en],:formats=>[:html],:handlers=>[:erb,:builder,:raw,:ruby,:coffee,:haml]}应用程序/评估 /app/contr

我希望表单在控制器中提交(发布)一个自定义操作,该操作将执行评估(基于表单中的数据),然后弹出一个包含评估结果的jQuery模型。诀窍是,我想让这个模式在表单上弹出,这样如果他们关闭模式,就可以返回并查看/编辑表单

我试过下面这样的方法,但不起作用。我得到以下错误:

缺少模板游戏/评估,使用{:locale=>[:en],:formats=>[:html],:handlers=>[:erb,:builder,:raw,:ruby,:coffee,:haml]}应用程序/评估

/app/controllers/games\u controller.rb

class ExercisesController < ApplicationController
  #...    
  def evaluate
    if( params[:id] )
      found = Game.find(params[:id])
      @eval = found.evaluate_guess(params[:guess])
    end  
  end
  #...
end
#...
get '/play/:id' => 'games#play', as: :play
patch '/play/:id' => 'games#evaluate', as: :evaluate
#...
/app/views/games/\u evaluation\u modal.html.haml

= semantic_form_for @games, :url => evaluate_path(@games) do |f|
  = f.semantic_errors
  = f.input :guess, 
    :as => :text
= f.actions do
  = f.action :submit, :label => "Guess!",
    :button_html => { :action => :evaluate, :method => :post } 
#evaluation_modal.modal.modal-wide.hide.fade
  = semantic_form_for @exercise, html: { class: 'modal-form' } do |f|
    .modal-header
    %h3 Results

    .modal-body
      #flashbar-placeholder
      %h2= CGI.unescapeHTML(@eval).html_safe
/app/views/games/evaluate.js.coffee

$('#evaluate').html(
  '<%= escape_javascript render partial: "evaluation_modal"  %>')
$('#evaluation_modal').modal('show')

尝试将
:remote=>true
添加到
play
表单中

= semantic_form_for @games, :url => evaluate_path(@games), :remote => true do |f|