why Marshal.dump a relation obejct would faile

with a special scope Marhal.dump(result) wolud cause a faile

*** TypeError Exception: no _dump_data is defined for class Proc


(byebug) result.class

BatchCloth::ActiveRecord_Relation

(byebug)  Marshal.dump(result)

*** TypeError Exception: no _dump_data is defined for class Proc

(byebug) puts result.to_sql

SELECT DISTINCT batch_cloths.*, batch_cloths.created_at FROM "batch_cloths" INNER JOIN "product_variants" ON "product_variants"."id" = "batch_cloths"."product_variant_id" LEFT OUTER JOIN "quality_control_tasks" ON "quality_control_tasks"."id" = "batch_cloths"."quality_control_task_id" AND "quality_control_tasks"."deleted_at" IS NULL INNER JOIN "reception_items" ON "reception_items"."id" = "quality_control_tasks"."qcable_id" AND "reception_items"."deleted_at" IS NULL AND "quality_control_tasks"."qcable_type" = 'ReceptionItem' INNER JOIN "receptions" ON "receptions"."id" = "reception_items"."reception_id" AND "receptions"."deleted_at" IS NULL INNER JOIN "factories" ON "factories"."id" = "receptions"."factory_id" AND "factories"."deleted_at" IS NULL WHERE "batch_cloths"."deleted_at" IS NULL AND "batch_cloths"."company_id" = 2 AND "factories"."uuid" = 'df9dbf09-fd10-4546-a511-e103bed8a6e4' AND "batch_cloths"."sample" = FALSE AND "product_variants"."variant_category" = 0 AND "batch_cloths"."stock_status" IN (0, 5, 6, 1) ORDER BY batch_cloths.created_at DESC

with a special scope Marhal.dump(result) wolud cause a faile

Proc objects just can’t be dumped - this is a limitation of ruby.

Fred