我有两个控制器,foo和bar。
bar#dobar有一个对应的dobar.js.erb文件,当直接使用
*/*;q=0.5, text/javascript, application/javascript, application/ecmascript, application/x-ecmascriptfoo#dofoo以命令render :action => '/bar/dobar'结束。这将导致以下错误消息:
ActionView::MissingTemplate (Missing template foo/bar/action, /application/bar/action 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:
* "/Developer/Workspace/MyProj/app/views"
* "/Users/bdares/.rvm/gems/ruby-1.9.3-p194/gems/twitter-bootstrap-rails-2.1.0/app/views"
):
app/controllers/foo_controller.rb:16:in `dofoo'我也试过:
render :action => '/bar/dobar', :format => [:js]render :action => 'bar/dobar'render :template => '/bar/dobar', :format => [:js]怎么了?
发布于 2012-07-12 05:41:03
如果您只是调用模板而不是操作,请尝试此操作,
render :template => 'bar/dobar', :format => [:js]https://stackoverflow.com/questions/11444308
复制相似问题