Public feed
#726119
# Methods added to this helper will be available to all templates in the application.module ApplicationHelper def getBrandsInCityByName(name) #make sure we can find the city, if not we send the user back to the site index to pick a valid city unless (current_city = City.find_by_name(name)).nil? #get a list of all city_brands that are associated with the current city city_brands = CityBrand.find(:all, :conditions => "city_id=#{@current_city.city_id}").to_a brands_on_this_page = Array.new #fill an array with each brand that belongs to this current city for city_brand in city_brands brands_on_this_page << Brand.find_by_brand_id(city_brand.brand_id) end return brands_on_this_page else return false end endend