On Thursday, June 21, 2018 at 4:56:35 PM UTC-7, Szwedko, Jesse (ADM) wrote: > > Thanks for the quick response! > > > > I believe I see what your suggestion is doing, looking at the deserialized > value if the attribute is string, but this doesn’t appear to solve the > issue that the serialization itself is raising an exception due to the > string value being invalid GeoJSON; as this step now happens before > `validate` is even called. > > > > To test, I did replace the code with your suggestion, but still get the > error during serialization. The full stack trace, which shows the error > happening during _before_validation: > I see, your serializer doesn't handle the object it is supposed to be serializing, because the object is invalid. You are running an old version of Sequel (_before_validation was removed in Sequel 5). Upgrade to the current version of Sequel, move the validates_geometry call from validate to before_validation:
def before_validation validates_geometry(:geom) deserialized_values.delete(:geom) if errors.on(:geom) # avoid attempting to serialize invalid value super end For older Sequel versions, you can probably override _before_validation instead. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
