Class: SitesTasks

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/sites_tasks.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.n_reports_galleriesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sites_tasks.rb', line 10

def self.n_reports_galleries
  Site.each do |site|
    puts! site
    save = false
    if site.n_galleries.blank?
      site.n_galleries = site.galleries.length
      save = true
    end
    if site.n_reports.blank?
      site.n_reports = site.reports.length
      save = true
    end
    if save
      if site.save
        puts( "+++ +++ Site #{site.domain}/#{site.lang}" )
      end
    end
  end
end

Instance Method Details

#pretty_date(args) ⇒ Object



6
7
8
# File 'lib/sites_tasks.rb', line 6

def pretty_date args
  args.strftime('%Y-%m-%d')
end