app/models/place.rb
# Update the associated place_geometry or create a new one
Update the associated place_geometry or create a new one
Update the associated place_geometry or create a new one
def save_geom(geom, other_attrs = {})
    other_attrs.merge!(:geom => geom, :place => self)
    begin
      if place_geometry
        self.place_geometry.update_attributes(other_attrs)
      else
        pg = PlaceGeometry.create(other_attrs)
        self.place_geometry = pg
      end
      update_bbox_from_geom(geom) if self.place_geometry.valid?
    rescue ActiveRecord::StatementInvalid => e
      Rails.logger.error "[ERROR] \tCouldn't save #{self.place_geometry}: #{e.message[0..200]}"
    end
  end
def save_geom ( geom , other_attrs = { } ) other_attrs . merge! ( :geom => geom , :place => self ) begin if place_geometry self . place_geometry . update_attributes ( other_attrs ) else pg = PlaceGeometry . create ( other_attrs ) self . place_geometry = pg end update_bbox_from_geom ( geom ) if self . place_geometry . valid? rescue ActiveRecord :: StatementInvalid => e Rails . logger . error "[ERROR] \tCouldn't save #{self.place_geometry}: #{e.message[0..200]}" end end
Update the associated place_geometry or create a new one
Update the associated place_geometry or create a new one
geom
other_attrs