Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
yleek opened this issue Aug 30, 2023 · 3 comments
Closed

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

yleek opened this issue Aug 30, 2023 · 3 comments

Comments

@yleek
Copy link

yleek commented Aug 30, 2023

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.

@iberianpig
Copy link
Contributor

This issue has been fixed and merged at #286, but has not been released to Rubygems.

Use gem "active_hash", github: "active-hash/active_hash", commit: "master" in the Gemfile to get around this.

@yleek
Copy link
Author

yleek commented Aug 31, 2023

Thank you for your comment.
I confirm that respond_to? method can use at master branch.
This issue is closed.

@yleek yleek closed this as completed Aug 31, 2023
@flavorjones
Copy link
Collaborator

v3.2.1 should be out soon, see #290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants