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 master does not work with Rails 6.0 RC1 #1032

Closed
ozzyaaron opened this issue Jun 13, 2019 · 12 comments
Closed

Ransack master does not work with Rails 6.0 RC1 #1032

ozzyaaron opened this issue Jun 13, 2019 · 12 comments

Comments

@ozzyaaron
Copy link

ozzyaaron commented Jun 13, 2019

Please don't take this as any negativity, its awesome to see you guys are prepped for Rails 6.0 master :)

That being said I just spent a bit of time I hope to save for others to say that Rails RC1 does not have the change in method signature to ::ActiveRecord::Associations::JoinDependency.initialize that is being used by Ransack when you're running Rails 6.

It might have been good for the commits to Ransack to prepare by using .rc2 instead of .rc1 but I'm not sure myself and it isn't the point of this issue.

The commit changing ::ActiveRecord::Associations::JoinDependency.initialize was committed a few days after Rails RC1 was cut(rails/rails#36120) but Ransack is already attempting to use it if it detects your Rails version is >= Rails 6.0.0.rc1

It is up to the Ransack team as to whether they'd like to make changes given that Rails hopefully will cut a RC2 soon and this issue will become moot. I just wanted to let other developers figure this issue out more quickly as they're upgrading or using Rails 6.

@scarroll32
Copy link
Member

Hi @ozzyaaron thanks for posting this issue, and also for the constructive feedback. Thank you especially to @vrodokanakis who has done a huge amount of work to support Rails 6.

Rails 6 support has become a bit of a headache, esp. as it is not yet released and is changing. We need to support it, but perhaps we should hang back? The commit to master has not yet been cut into a new gem release, so it would be possible to back it out, and then wait for Rails 6 to be officially released.

The other option would be to patch the code in master and try to keep up with changes in the Rails 6 release candidates.

What is the community's feeling on this?

@vrodokanakis
Copy link
Contributor

vrodokanakis commented Jun 15, 2019

@ozzyaaron has a good point that its not clear enough that the current master branch is only compatible with latest Rails 6-0-stable branch and not 6.0.0.rc1. And this may lead to confusion.

But I don't think it's better to back out. It's been almost two months since rc1 was released so rc2 must be around the corner. In the original release schedule, which was a bit optimistic, DHH announced a timeframe of 1 month between rc1 and rc2.

My suggestion (as temporary measure) is to display a visible warning in Readme to prevent anyone from trying to use it or debug it with Rails 6.0.0.rc1.

I'll make sure when rc2 is released to change the minimum dependencies so this issue won't be anymore.

@scarroll32
Copy link
Member

Great, thanks @vrodokanakis. I've added a note and we can review this when Rails 6 is offically released. I'll cut a new version of the gem soon.

@zocoi
Copy link

zocoi commented Jul 8, 2019

gem 'rails', github: 'rails/rails', branch: '6-0-stable'
gem 'ransack'

Hi all, just FYI, it looks like ransack no longer works with the stable branch and have a new issue.

2.6.3 :003 > School.ransack
Traceback (most recent call last):
        1: from (irb):3
ArgumentError (wrong number of arguments (given 3, expected 4))

Edit: nvm, I should be using master branch instead

gem 'ransack', github: 'activerecord-hackery/ransack'

@deivid-rodriguez
Copy link
Contributor

Hi @seanfcarroll!

Would it be possible to cut a release with Rails 6.0.0.rc2 support? That should make it easier for users trying out Rails pre-releases.

@gregmolnar
Copy link
Member

I don't think it worth cutting a release to support an RC. You can just point to the master branch.

@deivid-rodriguez
Copy link
Contributor

I don't think it changes anything, but I think a prerelease would be enough.

Anyways, I understand, thanks for considering anyways :)

@thibpoullain
Copy link

gem 'ransack', github: 'activerecord-hackery/ransack'

Solved the problem for me.

@jaredbeck
Copy link
Contributor

If you are trying to use ransack master with rails 6.0.0 final (released today 🎉) you might want to use this patch: #1054

@ranupratapsingh
Copy link

Hi all,
Ransack breaking with rails 6.0.0 (released today)
Ransack version: 2.1.1 (even on master branch aada895)

@jaredbeck
Copy link
Contributor

New release ransack 2.3.0 supports rails 6.0.0 final.

@PhilCoggins
Copy link
Contributor

Posting here to hopefully get some more visibility on #1039.

Polymorphic searching with Ransack is fundamentally broken since Activerecord 5.2.0. The linked issue lays out an error undefined method polymorphic?, which no longer happens since 5-2 stable, but there is an additional issue with invalid join statements being generated when searching on polymorphic relations.

@deivid-rodriguez graciously opened a PR to attempt to fix the undefined method polymorphic? error, but the invalid join statements are still a problem (see #1077 (comment)). I would tread very, very lightly if you are using this library for searching on Polymorphic relations on any AR version > 5.2, including 6.

If there are any contributors / maintainers that could spend some time trying to fix this issue, it would really help a lot of people out. Otherwise, polymorphic support should be removed entirely for AR versions > 5.2.

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

10 participants