ruby - Getting sinatra and the sitemap_gererator gem to play together nicely -


the sitemap_generator gem successfully creates , uploads sitemap static pages of app amazon s3 bucket.

now i'd instruct gem include each article article model dynamically.

this error get:

rake aborted! wrong constant name #<class:0x007f80d5858b00> 

so, clear, issue having trying sitemap_generator gem play nicely article model.

i using following gem versions:
ruby 1.9.3
sinatra v 1.4.4
sinatra-activerecord 1.5
sitemap_generator 5.0.1

config/sitemap.rb:

require 'rubygems' require 'sinatra' require 'sinatra/base' require 'sinatra/activerecord' require './config/environments' require 'sitemap_generator' require 'carrierwave' require './config/initializers/carrierwave'  class article < activerecord::base end  sitemapgenerator::sitemap.default_host = "http://www.mywebsite.com" sitemapgenerator::sitemap.public_path = 'tmp/' sitemapgenerator::sitemap.adapter = sitemapgenerator::waveadapter.new sitemapgenerator::sitemap.sitemaps_host = "http://#{env['s3_bucket']}.s3.amazonaws.com/" sitemapgenerator::sitemap.sitemaps_path = 'sitemaps/'  sitemapgenerator::sitemap.create    # part works.   add '/company', :changefreq => 'weekly', :priority => 0.9   add '/team', :changefreq => 'weekly', :priority => 0.9   add '/services', :changefreq => 'weekly', :priority => 0.9   add '/blog', :changefreq => 'weekly', :priority => 0.9   add '/contact', :changefreq => 'weekly', :priority => 0.9    # part doesn't work.   article.find_each |article|     add "/blog/#{article.url}", :lastmod => article.updated_at   end  end 

i had add class:: before declaring , using article class.

updated code:

class class::article < activerecord::base end  sitemapgenerator::sitemap.create   class::article.find_each |article|     add "/blog/#{article.url}", :lastmod => article.updated_at   end end 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -