Skip to content

JBuilder 2.11.3: "NoMethodError Exception: undefined method empty? for PG::Result" #516

@jtannas

Description

@jtannas

When rendering records returned by SQL JBuilder fails with

NoMethodError Exception: undefined method `empty?` for PG::Result

Simplified example:

irb(main):001:0> query_result = ActiveRecord::Base.connection.execute('SELECT * FROM users LIMIT 1')
=> #<PG::Result:0x00005594547c1120 status=PGRES_TUPLES_OK ntuples=1 nfields=31 cmd_tuples=1>
irb(main):002:0> query_result.empty?
(irb):2:in `<main>': undefined method `empty?' for #<PG::Result:0x00005594547c1120 status=PGRES_TUPLES_OK ntuples=1 nfields=31 cmd_tuples=1> (NoMethodError)

Ruby Version: 3.0.2p107
Jbuilder Gem Version: 2.11.3
PG Gem Version: 1.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions