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

DEV: Upgrade Rails to 6.1.3.1 #12688

Merged
merged 3 commits into from Apr 21, 2021
Merged

DEV: Upgrade Rails to 6.1.3.1 #12688

merged 3 commits into from Apr 21, 2021

Conversation

OsamaSayegh
Copy link
Member

This PR fixes all the deprecations and errors when running Discourse against Rails 6.1.3.1. This PR needs discourse/rails_failover#27 to be merged and released before this can be merged.

Copy link
Contributor

@CvX CvX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! 🤩

app/controllers/admin/backups_controller.rb Show resolved Hide resolved
OsamaSayegh added a commit to discourse/discourse-yearly-review that referenced this pull request Apr 15, 2021
Related to discourse/discourse#12688.

Rails 6.1 changes the initializer of `ActionView::Base` to require 3 arguments. Instead of creating the instance ourselves, we can use the [`ActionView::Base.with_view_paths`](https://github.com/rails/rails/blob/c5929d5eb55b749bc124b3ccc2d79323d015701f/actionview/lib/action_view/base.rb#L229-L231) method that gives us an instance with whatever view paths we need. The `with_view_paths` method is available in Rails 6.0.3.5 (Discourse's current Rails version), so this change is backward compatible.
OsamaSayegh added a commit to discourse/discourse-docs that referenced this pull request Apr 15, 2021
Related to discourse/discourse#12688.

The tags and categories count queries are failing on Rails 6.1 with `ERROR:  column "topics.bumped_at" must appear in the GROUP BY clause or be used in an aggregate function`. The reason these queries didn't fail prior to 6.1 was because Active Record would automatically drop the `ORDER BY` clause from the queries when we called `count` on them. This behavior has been [changed](rails/rails@5812fef) in 6.1 so now Active Record only drops the `ORDER BY` clause if there is no `GROUP BY` clause. Our queries do have `GROUP BY` clauses, so we need to drop the `ORDER BY` clauses ourselves before we call `count` to make them work on 6.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants