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

Failure on post-7.1 rails edge #212

Closed
jrochkind opened this issue Oct 22, 2023 · 4 comments
Closed

Failure on post-7.1 rails edge #212

jrochkind opened this issue Oct 22, 2023 · 4 comments

Comments

@jrochkind
Copy link
Owner

jrochkind commented Oct 22, 2023

CI is getting an error "no method "attributes_to_define_after_schema_loads""

This is one of the few places that attr_json reaches into some kind of wonky/internal Rails API.

And this is some weird rails API.

Apparently post Rails 7.1, Rails changes this API? Figure out the right alternative, put in some conditional logic to do it.

We like keeping things running on Rails edge as a continuous integrationt ask, so we don't wait until the next Rails release actually happens and have a bunch of technical debt.

https://github.com/jrochkind/attr_json/actions/runs/6602862051/job/17935386108

@jrochkind
Copy link
Owner Author

This commit looks relevant:

rails/rails@e0a55b0

@jrochkind
Copy link
Owner Author

This potentially could be a pretty major revision to Rails attributes API in ActiveRecord, not sure. We do lean on attributes API heavily, this could require some non-trivial work, not sure yet.

@jrochkind jrochkind changed the title CI failure on rails edge for no such method "attributes_to_define_after_schema_loads" Fix for post-7.1 rails edge, no method "attributes_to_define_after_schema_loads" Oct 22, 2023
@jrochkind jrochkind changed the title Fix for post-7.1 rails edge, no method "attributes_to_define_after_schema_loads" Failure on post-7.1 rails edge Nov 1, 2023
@jrochkind
Copy link
Owner Author

jrochkind commented Nov 1, 2023

There are other failures even once this one is worked around, specifically to dirty tracking working right. :(

If anyone wants to help me figure them out, it would be much appreciated.

jrochkind added a commit that referenced this issue Nov 2, 2023
…ibutes

We were using a `attributes_to_define_after_schema_loads` method which was private API, and which breaks in current Rails main branch post 7.1 release.

We switch to only using standard attribute API, and keeping track ourselves internally if this is the "first time" a container attrib is encountered, so if it needs an attribute registration. We don't want to multiply register the same attribute many times becaues although it would work, it's just messy and extra objects and calls for rails.

This is working -- we had pretty good test coverage, which helped us realize we needed to track specific sub-class too, and tests now all pass.

In the long-run, we might like a different public API that doesn't require us to implicitly know when first time container attrib is encountered. Like requires you to explicitly group things by container attribute. Or... this works and is fine? Could be!

This is one part of #212 although other failures are revealed once we fix this one.
@jrochkind
Copy link
Owner Author

OK, all fixed up! No technical debt here!

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

1 participant