Skip to content

Instantly share code, notes, and snippets.

@janjiss
Created August 20, 2013 17:35
Show Gist options
  • Select an option

  • Save janjiss/6284626 to your computer and use it in GitHub Desktop.

Select an option

Save janjiss/6284626 to your computer and use it in GitHub Desktop.
def get_coordinates
if @branch.present?
@show_cities = Purchase.where(:branch = @branch)
@show_sale_points = Purchase.find(:all, :select => "DISTINCT sale_point")
@show_all_blanches = Purchase.find(:all, :select => "DISTINCT branch")
@show_sale_points = Purchase.where(:city => @city, :branch => @branch) if @city.present?
if @city.present? && @sales_point.present?
coordinates = Purchase.where(:city => @city, :branch => @branch, :sale_point => @sale_point)
@latitude = coordinates.first.latitude
@longitude = coordinates.first.longitude
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment