Closed
Description
Testing one of my apps for Rails 5, and have noticed hash_tree
doesn't use the STI scope of the calling class. I can't pinpoint exactly where the issue is in the code, but can confirm the following SQL statements.
When calling Page.hash_tree
Rails 4.2
SELECT "nodes".* FROM "nodes" INNER JOIN (
SELECT descendant_id, MAX(generations) as depth
FROM "node_hierarchies"
GROUP BY descendant_id
) AS generation_depth
ON "noes".id = generation_depth.descendant_id
WHERE "nodes"."type" IN ('Page')
ORDER BY generation_depth.depth, sort_order
Rails 5
SELECT "nodes".* FROM "nodes" INNER JOIN (
SELECT descendant_id, MAX(generations) as depth
FROM "node_hierarchies"
GROUP BY descendant_id
) AS generation_depth
ON "nodes".id = generation_depth.descendant_id
ORDER BY generation_depth.depth, sort_order
Notice that rails 5 does't include the WHERE "nodes"."type" IN ('Page')
condition.
Metadata
Metadata
Assignees
Labels
No labels