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

Merge refinery fixes #6

Merged
merged 3 commits into from
Dec 17, 2024
Merged

Merge refinery fixes #6

merged 3 commits into from
Dec 17, 2024

Conversation

anitagraham
Copy link
Owner

No description provided.

richard-kramer and others added 3 commits May 12, 2023 13:40
Resolves #3523

The issue stems from the definition of `Refinery::Pages::Finder` and its sibling classes (`Refinery::Pages::FinderByTitle` and so on). These are all defined beside each other in [`pages/lib/refinery/pages/finder.rb`](https://github.com/refinery/refinerycms/blob/aee49a603860bf7d5fdb1532b9add5f4e7f839f4/pages/lib/refinery/pages/finder.rb) which gets required in [`pages/app/models/refinery/page.rb`](https://github.com/refinery/refinerycms/blob/aee49a603860bf7d5fdb1532b9add5f4e7f839f4/pages/app/models/refinery/page.rb#L6).

When reloading, Zeitwerk reloads the model, which in turn loads the finder again. But because the file is named `finder.rb`, only `Refinery::Pages::Finder` gets unloaded and reloaded again. All other classes stay loaded and would be patched by the reload. But because `Refinery::Pages::Finder` has been reloaded and initialized again, it got a new `object_id`, thus triggering the **`superclass mismatch`** error.

The solution, that fixed the error, was to move all sibling-classes of `Refinery::Pages::Finder` into it, making them children of `Refinery::Pages::Finder`. Because they are only called inside `Refinery::Pages::Finder` itself, this *should* not make problems.
The former was removed in more recent versions of Ruby.
I noticed when running `rails new -m https://www.refinerycms.com/t/edge`
that it was mangling the `Gemfile` when the `sqlite3` line looked like:

```ruby
  gem 'sqlite3', '~> 1.4'
```

Instead of the expected:

```ruby
  gem 'sqlite3'
```

Our `gsub_file` instruction now captures the entire line and inserts it
inside the `group :development, :test do` block.
@anitagraham anitagraham merged commit bc748cd into anitagraham:ruby3 Dec 17, 2024
0 of 10 checks passed
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.

3 participants