lib/wcc/contentful/store/postgres_store.rb in wcc-contentful-1.0.0 vs lib/wcc/contentful/store/postgres_store.rb in wcc-contentful-1.0.1

- old
+ new

@@ -251,15 +251,25 @@ "#{quote_parameter_path(path.take(3))}) @> " \ "jsonb_build_array($#{push_param(expected, params)}::jsonb)" end " AND t.data->#{quote_parameter_path(path)}" \ - " ? $#{push_param(expected, params)}::text" + " @> to_jsonb($#{push_param(expected, params)})" end + PARAM_TYPES = { + String => 'text' + + # These can be cast directly to jsonb + # Integer => 'jsonb' + # Float => 'jsonb' + }.freeze + def push_param(param, params) params << param - params.length + param_type = PARAM_TYPES[param.class] || 'jsonb' + + "#{params.length}::#{param_type}" end def quote_parameter_path(path) path.map { |p| "'#{p}'" }.join('->') end