Module: XmlHelper

Defined in:
app/helpers/xml_helper.rb

Instance Method Summary collapse

Instance Method Details

#collection_lastmod(collection) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/xml_helper.rb', line 4

def collection_lastmod(collection)
  article_updated = collection.contents.order(updated_at: :desc).first
   = collection.contents.order(published_at: :desc).first

  times = []
  times.push article_updated.updated_at if article_updated
  times.push .updated_at if 

  if times.empty?
    Time.zone.at(0).xmlschema
  else
    times.max.xmlschema
  end
end