Skip to content

Instantly share code, notes, and snippets.

@theinventor
Created November 19, 2012 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theinventor/4112372 to your computer and use it in GitHub Desktop.
Save theinventor/4112372 to your computer and use it in GitHub Desktop.
if ad_records.count == 1
ad_record = ad_records.first
ad = Ad.new(
:tagline => ad_record['tag_line'],
:service => service,
:image_url => ad_record['image_external_url'],
:citygrid_ad_id => ad_record['ad_id']
)
ad.image = Image.new(:name => ad_record['image_external_url'], :role => "AD_IMAGE", :url => ad_record['image_external_url'], :format => ad_record['image_external_url'].to_s.split('.').last )
#ad.geographies << self.get_geographies_by_service(service)
geo_ids = self.get_geographies_by_service(service).map &:id
#FIXME - need the importer to use the new AdGeography methods to create the join table rows
AdGeography.update_service_areas(geo_ids,ad)
ad.categories << self.get_categories_by_service(service)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment