Closed LocoDelAssembly closed 4 years ago
This is likely due to a bad string not being handled in the Georeference::GeoLocate. IIRC the param is passed in as shape
, to a virtual attribute, then attempted to be converted before save. The Georeference then does a test to see that the Collecting Event geographic area contains that area- which likely isn't correct, and a string, not a GeographicItem, because of a failed parse?
@mjy my thinking was it could be bad params during create/update, but now we also have problems with autocomplete which works with objects from DB only. Either or I'm extremely unlucky and I always get a database dump by the time the offending GeographicItem
is fixed or there is something else going on.
Also, given cast_value and parse_wkt (which actually also parses WKB), parse errors should result in nil
to be returned, not raw column value.
@mjy discovered related issues in RGeo repos. Enumerating below to keep track: https://github.com/rgeo/activerecord-postgis-adapter/pull/309 https://github.com/rgeo/activerecord-postgis-adapter/issues/307
There is a recent increase of exception notification messages (e.g. "undefined methods
contains?
for String", undefined method 'x' for String, etc.). I already found these errors very unexpected, but the latest ones fromcollecting_event/autocomplete
(which cause "undefined method 'x'") are even more surprising to me.I've tried several times to replicate locally by getting a copy of the production database and exercising the URLs but nothing happened.
Also scanned the database to see if I can get a String instead of RGeo subtype, but other than NilClass, no other types emerged. For the error caused at https://github.com/SpeciesFileGroup/taxonworks/blob/11db6e6bd/app/helpers/collecting_events_helper.rb#L70 I tested with this code:
I don't know what else to do. The referrer seems to always be Comprehensive Specimen Digitization task, and the same project and perhaps user. However, even if there is a frontend bug, I don't see how could it explain getting strings instead of geographic projections.
Also looked into RGeo, postgis-adapter and ActiveModel, in particular code around
cast_value
, but unless in some instances the column is generically typed instead of getting a concrete subclass, it should not return a String.Wonder if Zeitwerk would fix something.
Ref https://github.com/SpeciesFileGroup/taxonworks/commit/ecfafd1b16797b8202c55034da4345eb8af860e5 (some of the
contains?
error, others happen inside RGeo gem because rhs is String)I get: