Skip to content

ActiveHash::Relation can not use respond_to? method #289

@yleek

Description

@yleek

Hi!

system:
Rails: 6.1.4
Ruby: 3.0.6

active_hash:
old: 3.1.1
new: 3.2.0

I upgrade to 3.2.0 from 3.1.1.
I find that ActiveHash::Relation can not use respond_to? method.
An error occurs when using this method.
version 3.1.1 is not occurs this error.

class Country < ActiveHash::Base
  Country.data = [
    { :id => 1, :name => "US" },
    { :id => 2, :name => "Canada" }
  ]
end

> Country.all.class
=> ActiveHash::Relation

v3.2.0
> Country.all.respond_to?(:dummy_method)
NoMethodError: undefined method `key?' for nil:NilClass
from /app/vendor/bundle/ruby/3.0.0/gems/active_hash-3.2.0/lib/active_hash/relation.rb:173:in `respond_to_missing?'

v3.1.1
> Country.all.respond_to?(:dummy_method)
=> false

Is this a bug? please check it.

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