kjvarga/sitemap_generator

Cannot call SitemapGenerator::Sitemap from within namespaced route

Closed this issue · 1 comments

My Rails app is API-only, and using an endpoint to return a sitemap to the frontend.

The route is namespaced:

    namespace :api do
      namespace :v1 do
        get '/site/map', to: 'site#sitemap'
      end
    end

but when I call SitemapGenerator::Sitemap.create in the controller action, I get

NameError (uninitialized constant Api::V1::SiteController::SitemapGenerator):

Is there a way to make this work?

Oops — it turned out to be a bug further up the method that was breaking it; nothing to do with sitemap_generator at all. Apologies for the spam 😊