Class: SitemapsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/sitemaps_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/sitemaps_controller.rb', line 4

def index
  @entries = {}
  Cms::SitemapSubmitter.models.each do |model|
    last_update = model.classify.constantize.bcms_sitemap_last_update
    @entries[model.pluralize] = last_update if last_update
  end
end

#modelObject



12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/sitemaps_controller.rb', line 12

def model
  model = params[:model]
  @objects = model.classify.constantize.bcms_sitemap_scope
  instance_variable_set("@#{model}", @objects) # Template usually wants @pages, @news_articles etc
  if Rails.root.join('app','views','sitemaps',"#{model}.builder").exist?
    render "#{model}.builder"
  else
    render 'model.builder'
  end
end