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

ruby-grape / grape / 32339560319
97%

Build:
DEFAULT BRANCH: master
Ran 20 Aug 2026 06:26AM UTC
Jobs 32
Files 168
Run time 1min
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

20 Aug 2026 06:25AM UTC coverage: 96.999% (+0.02%) from 96.978%
32339560319

push

github

web-flow
Look up an entity by the object's own class before its element's (#2844)

Grape::DSL::Entity#object_class decided which class to look an entity up for
by duck-typing:

    return object.klass if object.respond_to?(:klass)
    return object.first.class if object.respond_to?(:first)
    object.class

Both tests are answered by plenty of single objects, and the object's own
class was consulted only last. A Struct is Enumerable, so it responds to
#first; so does any model that includes Enumerable; and #klass is hardly
exclusive to ActiveRecord::Relation. For all of those, `represent Model,
with: Entity` was silently ignored and the entity for whatever #first
returned was looked up instead -- usually nothing, so the raw object was
serialized.

Try the object's own class first and fall back to the collection or wrapped
class only when that comes up empty. An Array still resolves through its
element class, since Array itself has no entity, and a relation still
resolves through #klass.

Deferring the fallback also stops #first from being called at all when the
object resolves on its own class, which matters for anything where taking
the first element is expensive or has side effects.

Longstanding: the duck-typing dates to 2014 (v0.10.0) and behaves the same
way in 3.3.4.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

1214 of 1303 branches covered (93.17%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 1 file covered. (100.0%)

3829 of 3896 relevant lines covered (98.28%)

27105.13 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/multi_json.gemfile - 32339560319.1 20 Aug 2026 06:26AM UTC 167
47.64
GitHub Action Run
2 run-3.4-gemfiles/rails_8_0.gemfile - 32339560319.2 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
3 run-3.4-gemfiles/rack_3_0.gemfile - 32339560319.3 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
4 run-3.4-gemfiles/rails_7_2.gemfile - 32339560319.4 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
5 run-4.0-gemfiles/rails_7_2.gemfile - 32339560319.5 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
6 run-4.0-gemfiles/rack_3_2.gemfile - 32339560319.6 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
7 run-3.4-gemfiles/rack_2_2.gemfile - 32339560319.7 20 Aug 2026 06:26AM UTC 167
95.69
GitHub Action Run
8 run-4.0-gemfiles/rack_3_1.gemfile - 32339560319.8 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
9 run-4.0-gemfiles/multi_xml_0_8.gemfile - 32339560319.9 20 Aug 2026 06:26AM UTC 167
47.08
GitHub Action Run
10 run-4.0-gemfiles/dry_validation.gemfile - 32339560319.10 20 Aug 2026 06:26AM UTC 167
58.08
GitHub Action Run
11 run-3.3-Gemfile - 32339560319.11 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
12 run-4.0-gemfiles/grape_entity.gemfile - 32339560319.12 20 Aug 2026 06:26AM UTC 167
50.38
GitHub Action Run
13 run-3.3-gemfiles/rack_3_1.gemfile - 32339560319.13 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
14 run-3.3-gemfiles/rack_3_0.gemfile - 32339560319.14 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
15 run-3.4-gemfiles/rack_3_2.gemfile - 32339560319.15 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
16 run-4.0-gemfiles/multi_json_1_20.gemfile - 32339560319.16 20 Aug 2026 06:26AM UTC 167
47.68
GitHub Action Run
17 run-3.3-gemfiles/rack_2_2.gemfile - 32339560319.17 20 Aug 2026 06:26AM UTC 167
95.69
GitHub Action Run
18 run-4.0-gemfiles/rack_2_2.gemfile - 32339560319.18 20 Aug 2026 06:26AM UTC 167
95.69
GitHub Action Run
19 run-4.0-gemfiles/rails_8_0.gemfile - 32339560319.19 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
20 run-3.3-gemfiles/rails_8_0.gemfile - 32339560319.20 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
21 run-4.0-gemfiles/multi_xml.gemfile - 32339560319.21 20 Aug 2026 06:26AM UTC 167
47.04
GitHub Action Run
22 run-4.0-Gemfile - 32339560319.22 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
23 run-4.0-gemfiles/hashie.gemfile - 32339560319.23 20 Aug 2026 06:26AM UTC 167
62.05
GitHub Action Run
24 run-3.3-gemfiles/rails_8_1.gemfile - 32339560319.24 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
25 run-4.0-gemfiles/rack_3_0.gemfile - 32339560319.25 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
26 run-3.4-Gemfile - 32339560319.26 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
27 run-3.3-gemfiles/rack_3_2.gemfile - 32339560319.27 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
28 run-4.0-gemfiles/rails_8_1.gemfile - 32339560319.28 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
29 run-4.0-gemfiles/grape_swagger.gemfile - 32339560319.29 20 Aug 2026 06:26AM UTC 167
55.38
GitHub Action Run
30 run-3.3-gemfiles/rails_7_2.gemfile - 32339560319.30 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
31 run-3.4-gemfiles/rails_8_1.gemfile - 32339560319.31 20 Aug 2026 06:26AM UTC 168
95.73
GitHub Action Run
32 run-3.4-gemfiles/rack_3_1.gemfile - 32339560319.32 20 Aug 2026 06:26AM UTC 167
95.73
GitHub Action Run
Source Files on build 32339560319
  • Tree
  • List 168
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #32339560319
  • 02781e77 on github
  • Prev Build on master (#32219634382)
  • Next Build on master (#32340564879)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc