app/models/rails_adserver/advertisement.rb in rails_adserver-1.0.0 vs app/models/rails_adserver/advertisement.rb in rails_adserver-1.0.1
- old
+ new
@@ -89,18 +89,18 @@
ad_ids = self.where("is_active = ? AND param_restriction = ? AND backup = ?",true, param, false).map(&:id)
end
id = ad_ids[rand(ad_ids.length)]
end
def self.geo_city(city)
- ad_ids = self.where("city_name = ? AND is_active = ?", city, true).map(&:id)
+ ad_ids = self.where("city_name = ? AND is_active = ? AND geolocation_boolean = ?", city, true,true).map(&:id)
id = ad_ids[rand(ad_ids.length)]
end
def self.geo_state(state)
- ad_ids = self.where("state_name = ? AND city_name = ? AND is_active = ?", state, nil, true).map(&:id)
+ ad_ids = self.where("state_name = ? AND city_name = ? AND is_active = ? AND geolocation_boolean = ?", state, nil, true, true).map(&:id)
id = ad_ids[rand(ad_ids.length)]
end
def self.geo_country(country)
- ad_ids = self.where("country_name = ? AND state_name = ? AND city_name = ? AND is_active = ?", country, nil, nil, true).map(&:id)
+ ad_ids = self.where("country_name = ? AND state_name = ? AND city_name = ? AND is_active = ? AND geolocation_boolean = ?", country, nil, nil, true, true).map(&:id)
id = ad_ids[rand(ad_ids.length)]
end
def self.backup_ad
ad_ids = self.where("backup = ?", true).map(&:id)
id = ad_ids[rand(ad_ids.length)]