Rails sitemap_generator Uninitialized Constant?

风流意气都作罢 提交于 2019-12-03 16:52:02

I'm the author of the gem. Better to open an issue on the GitHub page in future. SitemapGenerator does work in Rails 3 and Ruby 1.9.*. If you are running Rails, you don't need these lines:

require 'rubygems'
require 'sitemap_generator'

Also you generate your sitemaps by running Rake:

rake sitemap:refresh:no_ping

What is happening in your case is that because you're not running through Rake, the script does not know about the Product class, since your Rails environment hasn't been loaded.

Well, I wasn't able to get this gem working. My guess is that it doesn't work on Rails 3.1.2 or with Ruby 1.9. However, I was able to get another gem (big_sitemap) to work. Here is the link to it.

https://github.com/alexrabarts/big_sitemap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!