I have a project with PostGIS integration through RGeo gem. Rails 4, ruby 2.1.
RGeo has standard method contains?
which checks is point is located in polygon. Everything is fine in development (on MacOS X). But when I push my code to production server (Ubuntu 12.04) I have this error:
ActionView::Template::Error (Method Geometry#contains? not defined.):
app/models/address.rb:28:in `block in define_courier_area'
app/models/address.rb:28:in `define_courier_area'
The code is very simple. I just need to return an array of all CourierArea instances, where are Address coords located.
address.rb
class Address < ActiveRecord::Base
def define_courier_area # HAVE TO BE REFACTORED
arr = []
CourierArea.all.each { |ca| arr << ca if ca.poly.contains?(self.coords)}
arr.first if arr.first
end
end
I suppose, production environment can't obtain access to contains?
method, which is provided by RGeo gem. How can I solve this problem? Maybe I should insert require 'some_rgeo_file'
?