Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Model < ActiveRecord::Base
- geocoded_by :address, :latitude => :lat, :longitude => :lng
- def address
- [city, state].compact.join(', ')
- end
- end
- def in_bounds
- unless params[:polygon].nil?
- poly = params[:polygon].split('),(').map{|k| k = k.gsub(/[()]/, "")}
- all_points = []
- poly.each do |p|
- all_points.push (p.split(',').collect(&:strip).map{ |k| k = k.to_f})
- end
- render json: all_points
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement