2015-10-10 69 views
2

我試圖讓dynamic_sitemaps gem與我的站點一起工作,但是自述文件非常技術性強,目前我的頭腦還是有點過分。動態站點地圖錯誤

當我試圖爲這段代碼生成站點地圖時,我遇到了錯誤。

# You can have multiple sitemaps like the above – just make sure their names are different. 

# Automatically link to all pages using the routes specified 
# using "resources :pages" in config/routes.rb. This will also 
# automatically set <lastmod> to the date and time in page.updated_at: 
# 
sitemap_for :offers 

它返回下面的錯誤

ArgumentError: The collection given to sitemap_for must respond to find_each. This is for performance. Use Model.scoped to get an ActiveRecord relation that responds to find_each.

我期待有站點地圖包含我所有的報價帖子等

任何幫助,不勝感激!

回答

1

如果模型的名字是要約,儘量

sitemap_for Offer.all 

(注:#scoped被棄用,因此#ALL似乎是更好的選擇前進)

+0

曾爲血腥完美 - 感謝布賴恩! – Jonathan