我有Rails 3应用程序(运行Rails RC1),我有以下控制器:
class PluginsController < ApplicationController
respond_to :html, :xml, :json
def index
@plugins = Plugin.all
respond_with(@plugins)
end
end
http://localhost:3000/plugins
它工作得很好,向我展示了HTML版本。如果我想
http://localhost:3000/plugins.json
http://localhost:3000/plugins.xml
,我得到以下错误:
Template is missing
Missing template plugins/index with {:locale=>[:en, :en], :formats=>[:xml],
:handlers=>[:rjs, :haml, :erb, :rhtml, :builder, :rxml]} in view paths
"/Users/fcoury/Projects/backend/app/views",
"/Users/fcoury/Projects/backend/vendor/plugins/haml/app/views",
"/Users/fcoury/.rvm/gems/ree-1.8.7-2010.01@rails3/bundler/gems/
devise-6754ae7/app/views"
另外,我的ApplicationController非常简单:
class ApplicationController < ActionController::Base
protect_from_forgery
layout 'application'
end
我试过从控件中取出布局线,但结果相同。
plugins/index.html.haml
.