davetroy / votereport

Twitter Vote Report for Election Day 2008

votereport / app / models / android_reporter.rb
100644 19 lines (15 sloc) 0.521 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class AndroidReporter < Reporter
  before_create :set_location
 
  attr_accessor :latlon
  self.column_names << 'latlon' # needed to keep Reporter happy
    
  def source; "ADR"; end
  def source_name; "VoteReport Android App"; end
  def icon; "/images/iphone_icon.png"; end
  
  private
  def set_location
    self.latlon, location_accuracy = self.latlon.split(':')
    if self.location = Location.geocode(self.latlon)
      self.profile_location = self.location.address if self.profile_location.nil?
    end
  end
end