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

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

Build:
Build:
LAST BUILD BRANCH: v0.2.0
DEFAULT BRANCH: master
Ran 10 Nov 2016 08:36AM UTC
Jobs 14
Files 11
Run time 4min
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

pending completion
78

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.

393 of 394 relevant lines covered (99.75%)

212.32 hits per line

Jobs
ID Job ID Ran Files Coverage
1 78.1 (2.0.0, gemfiles/rails3.1.gemfile) 10 Nov 2016 08:36AM UTC 0
96.7
Travis Job 78.1
3 78.3 (2.0.0, gemfiles/rails4.0.gemfile) 10 Nov 2016 08:37AM UTC 0
96.45
Travis Job 78.3
4 78.4 (2.0.0, gemfiles/rails4.1.gemfile) 10 Nov 2016 08:36AM UTC 0
96.45
Travis Job 78.4
5 78.5 (2.0.0, gemfiles/rails4.2.gemfile) 10 Nov 2016 08:36AM UTC 0
97.72
Travis Job 78.5
6 78.6 (2.1.2, gemfiles/rails3.1.gemfile) 10 Nov 2016 08:38AM UTC 0
96.7
Travis Job 78.6
7 78.7 (2.1.2, gemfiles/rails3.2.gemfile) 10 Nov 2016 08:38AM UTC 0
96.45
Travis Job 78.7
8 78.8 (2.1.2, gemfiles/rails4.0.gemfile) 10 Nov 2016 08:38AM UTC 0
96.45
Travis Job 78.8
9 78.9 (2.1.2, gemfiles/rails4.1.gemfile) 10 Nov 2016 08:38AM UTC 0
96.45
Travis Job 78.9
10 78.10 (2.1.2, gemfiles/rails4.2.gemfile) 10 Nov 2016 08:39AM UTC 0
97.72
Travis Job 78.10
11 78.11 (2.2, gemfiles/rails3.1.gemfile) 10 Nov 2016 08:40AM UTC 0
96.7
Travis Job 78.11
12 78.12 (2.2, gemfiles/rails3.2.gemfile) 10 Nov 2016 08:40AM UTC 0
96.45
Travis Job 78.12
13 78.13 (2.2, gemfiles/rails4.0.gemfile) 10 Nov 2016 08:41AM UTC 0
96.45
Travis Job 78.13
14 78.14 (2.2, gemfiles/rails4.1.gemfile) 10 Nov 2016 08:40AM UTC 0
96.45
Travis Job 78.14
15 78.15 (2.2, gemfiles/rails4.2.gemfile) 10 Nov 2016 08:40AM UTC 0
97.72
Travis Job 78.15
Source Files on build 78
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #78
  • 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