錯誤: 模板丟失導軌xml.builder缺少模板錯誤
缺少模板雜/地圖,應用/網站地圖與{:區域設置=> [:EN]:格式=> [:XML],:處理程序=> [:erb,:builder]}。搜索:*「/ Users/yliu/Google Drive/ruby projects/Blog/lenswish/app/views」*「/usr/local/rvm/gems/ruby-1.9.3-p194/bundler/gems/twitter-bootstrap -rails-4b8a511e6518 /應用/視圖」 * 「/usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-3.1.0/app/views」
耙路線:
GET /sitemap.xml(.:format) miscellaneous#sitemap {:format=>"xml"}
routes.rb中:
get "sitemap.xml", :to => "miscellaneous#sitemap", defaults: { format: "xml" }
控制器:
class MiscellaneousController < ApplicationController
def sitemap
@card_templates = CardTemplate.all
respond_to do |format|
format.xml
end
end
end
模板位置: 應用程序/視圖/雜項/ sitemap.xml.builder
內容模板sitemap.xml.builder:
# Sitemaps 0.9 XML format: http://www.sitemaps.org/protocol.php
xml.instruct!
xml.urlset :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
xml.url do
xml.loc root_url
xml.changefreq 'daily'
xml.lastmod @card_templates.first.updated_at.iso8601
xml.priority '0.8'
end
end
我已籤文件的權限問題。還是行不通。任何人都請幫忙。提前致謝。
不適合我。仍然有同樣的錯誤。 –
做了一些更改。讓我知道這是否有幫助。 –
仍然收到相同的錯誤。更多信息:我在Ruby 1.9.3 rails 3.2.13上。謝謝。 –