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

Handle alternative base classes in define_attribute_methods #50706

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

casperisfine
Copy link
Contributor

Ref: d429bfb#r136670440

cc @ghiculescu @rafaelfranca

Before merging, I'd like a repro, so I can include a test case though.

@casperisfine
Copy link
Contributor Author

Error:
AttributeMethodsTest#test_#alias_attribute_method_on_a_STI_class_is_available_on_subclasses:
NoMethodError: undefined method `text' for #<#<Class:0x00007fb640e405b8> id: nil>
    /rails/activemodel/lib/active_model/attribute_methods.rb:482:in `method_missing'
    /rails/activerecord/lib/active_record/attribute_methods.rb:491:in `method_missing'
    /rails/activerecord/test/cases/attribute_methods_test.rb:1414:in `block in <class:AttributeMethodsTest>'

Seems legit.

@ghiculescu
Copy link
Member

@casperisfine @byroot here's a replication: https://github.com/ghiculescu/rails-50706. The readme has instructions, and ghiculescu/rails-50706@eeb1882 has the minimum steps (I think) needed to replicate.

@casperisfine
Copy link
Contributor Author

@ghiculescu thanks, so I confirm this PR fixes your repo.

However it now fails on CI, I have to dig into it.

@byroot byroot merged commit 0496a5f into rails:main Jan 15, 2024
3 of 4 checks passed
@casperisfine casperisfine deleted the attr-base-class branch January 15, 2024 16:29
@ghiculescu
Copy link
Member

Thanks @byroot <3 That's working for us in CI now.

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

Successfully merging this pull request may close these issues.

None yet

4 participants