我的 routes.rb 中有以下内容:
match 'admins/approve' => 'admins#approve', :as => :admins_approve, :method => :post
在我的 admins_controller.rb 我有:
def approve
render :update do |page|
page << "alert(" + params[:note] + ");"
end
end
在我的管理员/index.html.erb 中:
<% @users.each do |user| %>
<tr>
<td class= "action_add_note">
<%= form_tag admins_approve_path, :id => "form_note_#{user.id}", :remote=> true do %>
<%= text_area_tag 'note' %>
<% end %>
<%= link_to_function content_tag(:i, "", :class => 'icon-ok' ),
"$('#form_note_#{user.id}').submit();", :class => "btn"%>
</td>
</tr>
<% end %>
我知道我可以使用按钮代替功能,但这里不是这种情况,无论如何,每当我提交它时,我都会以某种方式得到错误的路径并出现以下错误:
ActionView::MissingTemplate (Missing template admins/update, application/update with {:locale=>[:en], :formats=>[:js, "application/ecmascript", "application/x-ecmascript", :html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :coffee]}. Searched in:
* "/Users/Apple/code/rails_pp/app/views"
* "/Users/Apple/.rvm/gems/ruby-1.9.2-p180/gems/twitter-bootstrap-rails-2.1.1/app/views"
app/controllers/admins_controller.rb:11:in `approve'
Rendered /Users/Apple/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/missing_template.erb within rescues/layout (0.6ms)