-
Notifications
You must be signed in to change notification settings - Fork 18
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
Descendants tracking error when cache_classes = true
#35
Comments
Me too. |
Same here. |
See https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring. It needs to be explicitly set to |
@waiting-for-dev I read that the opposite way, i.e. it needs to be set to |
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
Yeah, that wording is confusing. See here instead https://guides.rubyonrails.org/configuring.html#config-cache-classes |
That's much clearer, thanks. |
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
@airblade, in the end, I think you're right. It should be |
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
I have the same error with Rails 7.0.2 and the new default Any chance to have this issue fixed @nertzy ? |
It doesn't fix the actual issue, but I added a local monkey-patch to get # spec/support/with_model.rb
module WithModel
class Model
# Workaround for https://github.com/Casecommons/with_model/issues/35
def cleanup_descendants_tracking
if defined?(ActiveSupport::DescendantsTracker) && !Rails.application.config.cache_classes
ActiveSupport::DescendantsTracker.clear([@model])
elsif @model.superclass.respond_to?(:direct_descendants)
@model.superclass.subclasses.delete(@model)
end
end
end
end |
Thanks for the workaround @stex ! |
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
It's [required by Rails 7](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0-spring). It was hitting us an an [issue related to the with_model gem](Casecommons/with_model#35).
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see solidusio@ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
Does #44 fix this issue? |
Unfortunately no, I still get the same error... Stex's workaround works like a charm, though. |
with_model is not compatible with Rails 7 [1]. We remove the dependency and use custom logic in the specs to create tables and models. [1] - Casecommons/with_model#35 [skip ci]
with_model is not compatible with Rails 7 [1]. We remove the dependency and use custom logic in the specs to create tables and models. [1] - Casecommons/with_model#35 [skip ci]
with_model is not compatible with Rails 7 [1]. We remove the dependency and use custom logic in the specs to create tables and models. [1] - Casecommons/with_model#35 [skip ci]
with_model is not compatible with Rails 7 [1]. We remove the dependency and use custom logic in the specs to create tables and models. We need to skip tests on MySQL because of https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html#caveats: > If you're on MySQL, then do not use Data Definition Language (DDL) > operations in nested transactions blocks that are emulated with > savepoints. That is, do not execute statements like 'CREATE TABLE' > inside such blocks. This is because MySQL automatically releases all > savepoints upon executing a DDL operation. When transaction is finished > and tries to release the savepoint it created earlier, a database error > will occur because the savepoint has already been automatically > released. [1] - Casecommons/with_model#35 [skip ci]
@nertzy is there a chance of some variant of @stex 's fix above being incorporated into a future release? I'm not sure what he means by "... doesn't fix the actual issue... ". It would appear calling For those looking, here's the commit to 7.0.0 that is the root of this: rails/rails@cb82f5f |
We're getting an error when we have
cache_classes = true
on CI with Rails 7.0.1:The text was updated successfully, but these errors were encountered: