Parent

Included Modules

City

Public Class Methods

clear() click to toggle source
# File app/models/city.rb, line 69
def self.clear
  if Rails.env.test?
    City.all.each { |r| r.remove }
  end
end
feature() click to toggle source
# File app/models/city.rb, line 51
def self.feature
  where( :is_feature => true )
end
for_homepage() click to toggle source
# File app/models/city.rb, line 94
def self.for_homepage
  cities = City.all.order_by( :name => :asc )
  cities = cities.delete_if do |c|
    ( false == c.is_feature ) && ( 0 == c.galleries.length ) && ( 0 == c.reports.length )
  end
  return cities
end
list() click to toggle source
# File app/models/city.rb, line 59
def self.list
  out = self.order_by( :name => :asc )
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
end
list_citynames(lang = 'en') click to toggle source
# File app/models/city.rb, line 64
def self.list_citynames lang = 'en'
  out = self.order_by( :name => :asc )
  [['', nil]] + out.map { |item| [ item['name_'+lang], item.cityname ] }
end
n_features() click to toggle source
# File app/models/city.rb, line 75
def self.n_features
  4
end
non_feature() click to toggle source
# File app/models/city.rb, line 55
def self.non_feature
  where( :is_feature => false )
end

Public Instance Methods

j_reports(args = {}) click to toggle source
# File app/models/city.rb, line 79
def j_reports args = {}
  out =  []
  self.reports.each do |r| # .page( params[:reports_page] 
    rr = r.clone
    # rr[:photo_url] = r.photo.photo.url( :mini ) unless r.photo.blank?
    # rr[:photo_url] ||= '/assets/missing.png'
    rr[:username] = r.user.username
    rr.created_at = r.created_at # pretty_date( r.created_at )
    rr[:tag_name] = r.tag.name unless r.tag.blank?
    rr[:tag_name] ||= ''
    out << rr
  end
  return out
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.