• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

take-five / activerecord-hierarchical_query / 78 / 15
100%
master: 94%

Build:
Build:
LAST BUILD BRANCH: v0.2.0
DEFAULT BRANCH: master
Ran 10 Nov 2016 08:40AM UTC
Files 11
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Nov 2016 08:30AM UTC coverage: 97.716%. First build
2.2, gemfiles/rails4.2.gemfile

push

travis-ci

take-five
Discard default scope order from recursive query

Given a model with default scope:
```
class LinkedItem < ActiveRecord::Base
  belongs_to :parent, class_name: 'LinkedItem', foreign_key: :parent_id
  default_scope -> { order('name ASC') }
end
```

When trying to build hierarchical query against this model
Builder applied default scope to recursive part of recursive query
which lead to invalid SQL queries:
```
SELECT "linked_items".* FROM "linked_items" INNER JOIN (WITH RECURSIVE "linked_items__recursive" AS ( SELECT "linked_items"."id", "linked_items"."parent_id" FROM "linked_items" WHERE "linked_items"."id" = $1 UNION ALL SELECT "linked_items"."id", "linked_items"."parent_id" FROM "linked_items" INNER JOIN "linked_items__recursive" ON "linked_items__recursive"."parent_id" = "linked_items"."id"  ORDER BY name ASC ) SELECT "linked_items__recursive".* FROM "linked_items__recursive") AS "linked_items__recursive" ON "linked_items"."id" = "linked_items__recursive"."id"
```

This commit removes any default ordering when applying default scope to
CTE terms.

385 of 394 relevant lines covered (97.72%)

15.24 hits per line

Source Files on job 78.15 (2.2, gemfiles/rails4.2.gemfile)
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 78
  • Travis Job 78.15
  • 1b0e034a on github
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc