Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Model < ActiveRecord::Base
  2. geocoded_by :address, :latitude => :lat, :longitude => :lng
  3.  
  4. def address
  5. [city, state].compact.join(', ')
  6. end
  7. end
  8.  
  9. def in_bounds
  10. unless params[:polygon].nil?
  11. poly = params[:polygon].split('),(').map{|k| k = k.gsub(/[()]/, "")}
  12. all_points = []
  13. poly.each do |p|
  14. all_points.push (p.split(',').collect(&:strip).map{ |k| k = k.to_f})
  15. end
  16.  
  17.  
  18. render json: all_points
  19. return
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement