rubyforgood / Flaredown

Flaredown web app and API
http://www.flaredown.com
GNU General Public License v3.0
39 stars 15 forks source link

Fix creating new patterns #546

Closed bklang closed 2 years ago

bklang commented 2 years ago

This is likely related to the Rails upgrade. When creating a new Pattern, the serializer is expecting a Hash, but was instead getting an ActionController::Parameters object. Since Mongo didn't know how to serialize that, it was throwing an HTTP 500 error like this:

BSON::Error::UnserializableClass - Value does not define its BSON serialized type: {"id"=>4853, "category"=>"foods", "label"=>"Soy flour, full-fat, roasted"}

Casting it to a hash makes it serializable.