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

Make ransack work with Rails 7.2 #1503

Merged
merged 6 commits into from
Jul 10, 2024
Merged

Make ransack work with Rails 7.2 #1503

merged 6 commits into from
Jul 10, 2024

Conversation

gregmolnar
Copy link
Member

…urselves. Closes #1491.

@gregmolnar
Copy link
Member Author

This one closes #1489 too.

@gregmolnar gregmolnar changed the title Delegate alias_tracker creation to AR Relation rather than doing it o… Make ransack work with Rails 7.2 Jul 10, 2024
@gregmolnar gregmolnar merged commit ef8e2cf into main Jul 10, 2024
30 checks passed
@gregmolnar gregmolnar deleted the rails-7-2 branch July 10, 2024 23:27
@night91
Copy link

night91 commented Jul 23, 2024

This PR added a breaking change, if you use Rails 7.1 you will get this error, when you were supporting rails 7.2.
I need now to roll back to ransack 4.1 till probably Rails 7.2 is fully released.

@gregmolnar
Copy link
Member Author

@night91 can you show me the error you are getting? The test suite is passing with 7.1.0, is that the version you are on?

@louiswdavis
Copy link

Also having the problem with Rails 7.1.3.4 & Ransack 4.2.0. Rolling back Ransack hasn't managed to help us though.

The Error

NoMethodError (undefined method `with_connection' for Rating:Class
Did you mean?  with_options):
  
app/controllers/concerns/programmes.rb:28:in `search_and_sort_applications'
app/controllers/programmes_controller.rb:75:in `show'
app/controllers/application_controller.rb:237:in `set_time_zone'
Started GET "/serviceworker.js" for ::1 at 2024-08-05 13:25:56 +0100
  
ActionController::RoutingError (No route matches [GET] "/serviceworker.js"):

Params

{ "q"=> { "ratings_account_id_not_in"=>["1"] } }

Models

class Application < ApplicationRecord
  belongs_to :added_by, class_name: 'Account'
  has_many :ratings, dependent: :destroy
  # ...
end

class Rating < ApplicationRecord
  belongs_to :account, optional: true
  belongs_to :application
  # ...
end

@Carmer
Copy link

Carmer commented Aug 9, 2024

rails 7.1.3.4
ransack: 4.20

Same error as above

NoMethodError (undefined method `with_connection' for ModelName:Class
Did you mean?  with_options):

@gregmolnar
Copy link
Member Author

My version comparison is incorrect. I will fix it a little later today and cut a new release. Thanks for reporting!

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.

Getting with_connection for an instance of ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
5 participants