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

Ransack for edge rails #1445

Conversation

tvongaza
Copy link
Contributor

@tvongaza tvongaza commented Oct 13, 2023

I'm actually not too sure why this code even exists. Rails officially only supports 6.1 as per https://guides.rubyonrails.org/maintenance_policy.html, maybe worth dropping support for older versions & just rolling these fixes in?

As I'm unsure of the side effects, this code just stops copying and pasting directories, instead load the last known good version and try to use that.

@deivid-rodriguez
Copy link
Contributor

Interesting!

I think the reason this code existed is that we needed different patches for the different versions that we supported. Sounds like things are more stable for us now and in our current support matrix these patches are exact duplicates of each other.

If that's the case, can we instead rename the folder to "activerecord", and always load that, without any magic?

@tvongaza
Copy link
Contributor Author

Good idea, I'll whip up a follow up PR trying to implement the change to simplify things.

@deivid-rodriguez
Copy link
Contributor

I just noticed we may actually need your solution or something similar given #1447.

@scarroll32
Copy link
Member

Nice refactor thanks @tvongaza

@scarroll32
Copy link
Member

@deivid-rodriguez any idea why the CI is getting stuck? I've re-run it but it stopping in the same place.

Screenshot 2023-10-21 at 12 32 39

@scarroll32
Copy link
Member

Good idea, I'll whip up a follow up PR trying to implement the change to simplify things.

Thanks @tvongaza or feel free to push directly to this PR. We can probably merge it as-is, but it would be cleaner with the approach @deivid-rodriguez suggested.

@scarroll32
Copy link
Member

@tvongaza could you please rebase this?

This branch is out-of-date with the base branch

@deivid-rodriguez
Copy link
Contributor

I don't think we can merge this as is after #1447, since we now have a Rails 6.1 specific monkey patch again.

What I think we can do is, have a main folder named "activerecord", and load that if a folder specific to current rails is not found. How about that?

@tvongaza tvongaza force-pushed the polyamorous-resilient-loading branch from 078cdcc to 621e0d5 Compare October 23, 2023 20:06
@tvongaza tvongaza force-pushed the polyamorous-resilient-loading branch from 621e0d5 to ccd1f64 Compare October 23, 2023 20:18
@tvongaza
Copy link
Contributor Author

Ok, updated the branch with the latest changes. I did not see a 6.1 specific monkey patch, as again 7.0 and 7.1 both just call the 6.1 code. I moved it all to an activerecord directory and did away with the specific version loading. I'm always a fan of removing code if it isn't needed, so I removed all the version specific loading, which, IMHO, can be revisited if it is ever needed again.

@deivid-rodriguez
Copy link
Contributor

deivid-rodriguez commented Oct 23, 2023

https://github.com/activerecord-hackery/ransack/pull/1447/files changes a 6.1 specific monkey patch so these files should not be identical.

@tvongaza
Copy link
Contributor Author

https://github.com/activerecord-hackery/ransack/pull/1447/files changes a 6.1 specific monkey patch so these files should not be identical.

But the 7.0 & 7.1 files just point to the 6.1 files - or am I missing something obvious?

They all look like this:

https://github.com/activerecord-hackery/ransack/blob/main/lib/polyamorous/activerecord_7.0_ruby_2/join_association.rb#L1
require 'polyamorous/activerecord_6.1_ruby_2/join_association'

@deivid-rodriguez
Copy link
Contributor

Oh, you're right I missed that! That's not ideal since for example in #1447 just to fix a Rails 6.1 specific issue, we ended up changing the monkey patches for every Rails version.

However, since that's what we're doing already, this seems fine, and it allows people to experiment with Ransack against edge Rails, which is good!

Can you remove the last commit though? I don't want to run CI in all PRs against a moving target like Rails edge, too unstable. We already run CI against Rails edge on a daily schedule.

@tvongaza tvongaza force-pushed the polyamorous-resilient-loading branch from 0e60cc3 to ccd1f64 Compare October 24, 2023 15:01
@tvongaza
Copy link
Contributor Author

Can you remove the last commit though? I don't want to run CI in all PRs against a moving target like Rails edge, too unstable. We already run CI against Rails edge on a daily schedule.

Oh nice, did realize the gem had a daily edge rails CI run. Commit removed.

@deivid-rodriguez
Copy link
Contributor

Ok, let's merge this. Thanks so much @tvongaza!

@deivid-rodriguez deivid-rodriguez merged commit fb6027d into activerecord-hackery:main Oct 24, 2023
63 checks passed
@dalibor
Copy link

dalibor commented Oct 26, 2023

Hello - could you please release 4.1.1 (?) with this fix?

4.1.0 fails with the following error, but ransack main seems to work well (testing with active admin).

`require': cannot load such file -- polyamorous/activerecord_7.2_ruby_2/join_association (LoadError)

Thanks!

@scarroll32
Copy link
Member

Hello - could you please release 4.1.1 (?) with this fix?

4.1.0 fails with the following error, but ransack main seems to work well (testing with active admin).

`require': cannot load such file -- polyamorous/activerecord_7.2_ruby_2/join_association (LoadError)

Thanks!

4.1.1 has been released

CC @deivid-rodriguez

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

Successfully merging this pull request may close these issues.

None yet

4 participants