-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove use of ActiveSupport::Configurable #2492
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
Remove use of ActiveSupport::Configurable #2492
Conversation
Context: Failure: ActiveModelSerializers::Test::SchemaTest#test_that_raises_with_a_invalid_json_body [/home/runner/work/active_model_serializers/active_model_serializers/test/active_model_serializers/test/schema_test.rb:129]: Expected /A JSON text must at least contain two octets!|unexpected token at ''/ to match "unexpected end of input at line 1 column 1". bin/rails test /home/runner/work/active_model_serializers/active_model_serializers/test/active_model_serializers/test/schema_test.rb:119
Context: /home/runner/work/active_model_serializers/active_model_serializers/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.10/lib/active_support/logger_thread_safe_level.rb:16:in `<module:LoggerThreadSafeLevel>': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError) rails/rails#54621
Context: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0. You can add ostruct to your Gemfile or gemspec to silence this warning.
Context: warning: mutex_m was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0. You can add mutex_m to your Gemfile or gemspec to silence this warning. /.rvm/rubies/ruby-3.4.7/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require': cannot load such file -- mutex_m (LoadError)
Context: Failure: ActiveModel::Serializer::ReflectionTest#test_no_href_in_vanilla_reflection [/.rvm/gems/ruby-3.4.7/gems/minitest-5.10.3/lib/minitest/assertions.rb:139]: Expected /undefined method `href'/ to match # encoding: US-ASCII "undefined method 'href' for an instance of ActiveModel::Serializer::HasOneReflection".
Rails 8.1 deprecated `ActiveSupport::Configurable` which this gem currently uses. ``` DEPRECATION WARNING: ActiveSupport::Configurable is deprecated without replacement, and will be removed in Rails 8.2. You can emulate the previous behavior with `class_attribute`. ``` This replaces the use of `ActiveSupport::Configurable` with an `ActiveSupport::OrderedOptions` class attribute.
fabb0c5 to
f11a95f
Compare
|
@wasifhossain Ok, I'm pretty sure I did it right. |
|
@wasifhossain any change this will be published to rubygems soon? |
|
@bf4 could you please help us on this? I am not so sure if the changes are worthy enough to get a new version at this moment. Until then, you may continue with this: |
|
Thanks for fixing this 🙏
Every Rails 8.1 app gets a deprecation warning, and for Rails 8.2 v0.10.15 probably wont work at all, so I think that warrants a new release 🙂 Ref: |
|
There is a bug in the current implementation, where the configuration object is shared across serializer subclasses. This is inherent behavior of In rails/rails#53970 that replaced In our app, we currently have this regression on ActiveModelSerializers.config.adapter = :json_api
class FooSerializer < ActiveModel::Serializer
config.adapter = :attributes
end
ActiveModelSerializers.config.adapter #=> :attributes |
|
I vote that this is a perfect reason for a release. It provides a fix to a warning that pops up on any rails command anyone does when using this gem. Pefect reason to have a release |
Purpose
Rails 8.1 deprecated
ActiveSupport::Configurablewhich this gem currently uses.Changes
This replaces the use of
ActiveSupport::Configurablewith anActiveSupport::OrderedOptionsclass attribute.Caveats
Related GitHub issues
N/A
Additional helpful information