在生产网站中,我有一个使用路线start#index
定义的主页。
这可以按预期工作。
现在,一些抓取工具正在扫描页面中的/crossdomain.xml
之类的内容,这会触发start
控制器运行,并尝试返回XML视图。
不幸的是我没有定义XML视图或模板或其他任何内容,因此会生成错误消息(通过电子邮件,因此非常烦人):
[Exception] start#index (ActionView::MissingTemplate) "Missing template
start/index with {:handlers=>[:rjs, :rhtml, :builder, :rxml, :erb],
:formats=>[:xml], :locale=>[:crossdomain, :en]} in view paths
所以我猜有两种选择:
我更喜欢第一种选择,但我不确定如何做到这一点?感谢您的建议或最佳实践的链接。
编辑,根据要求,输出rake routes
。我猜到第二行最后一行会出现一些错误?
new_editor_session GET /editors/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
editor_session POST /editors/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_editor_session GET /editors/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
/auth/:provider/callback(.:format) {:action=>"create", :controller=>"sessions"}
signout /signout(.:format) {:action=>"destroy", :controller=>"sessions"}
photo_of_week_submissions GET (/:locale)/submissions/photo_of_week(.:format) {:action=>"photo_of_week", :controller=>"submissions"}
select_photo_of_week_submission GET (/:locale)/submissions/:id/select_photo_of_week(.:format) {:action=>"select_photo_of_week", :controller=>"submissions"}
accept_submission GET (/:locale)/submissions/:id/accept(.:format) {:action=>"accept", :controller=>"submissions"}
submissions GET (/:locale)/submissions(.:format) {:action=>"index", :controller=>"submissions"}
POST (/:locale)/submissions(.:format) {:action=>"create", :controller=>"submissions"}
new_submission GET (/:locale)/submissions/new(.:format) {:action=>"new", :controller=>"submissions"}
edit_submission GET (/:locale)/submissions/:id/edit(.:format) {:action=>"edit", :controller=>"submissions"}
submission GET (/:locale)/submissions/:id(.:format) {:action=>"show", :controller=>"submissions"}
PUT (/:locale)/submissions/:id(.:format) {:action=>"update", :controller=>"submissions"}
DELETE (/:locale)/submissions/:id(.:format) {:action=>"destroy", :controller=>"submissions"}
login (/:locale)/login(.:format) {:to=>#<Proc:0x0000000103871938@/Library/Ruby/Gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/routing/mapper.rb:366>}
design (/:locale)/design(.:format) {:action=>"design", :controller=>"page"}
gallery (/:locale)/gallery(.:format) {:action=>"gallery", :controller=>"page"}
features (/:locale)/features(.:format) {:action=>"features", :controller=>"page"}
competition (/:locale)/competition(.:format) {:action=>"index", :controller=>"competition"}
facebook_albums (/:locale)/facebook-albums(.:format) {:action=>"facebook_albums", :controller=>"competition"}
facebook_photos (/:locale)/facebook-photos(.:format) {:action=>"facebook_photos", :controller=>"competition"}
facebook_upload (/:locale)/facebook-upload(.:format) {:action=>"facebook_upload", :controller=>"competition"}
root (/:locale)(.:format) {:action=>"index", :controller=>"start"}
root /(.:format) {:action=>"index", :controller=>"start"}