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

Fix ruby-head compatibility #159

Merged
merged 2 commits into from
Jun 29, 2020
Merged

Conversation

casperisfine
Copy link

I'm testing ruby-head and LoggerSilencer is causing issues:

RuntimeError: class variable @@silencer of ActiveSupport::Logger is overtaken by Logger
    (rails-9734dfa1a1a2) activesupport/lib/active_support/logger_silence.rb:25 in `silencer`
    (activerecord-session_store-1.1.3) lib/active_record/session_store/extension/logger_silencer.rb:44 in `silence_logger`
    (activerecord-session_store-1.1.3) lib/action_dispatch/session/active_record_store.rb:123 in `get_session_model`
    (activerecord-session_store-1.1.3) lib/action_dispatch/session/active_record_store.rb:140 in `find_session`

What happens is that LoggerSilencer uses the same class variable than AS::LogerSilence but sets it in ::Logger rather than AS::Logger. On Ruby 2.8/3.0 it raises an error (on previous versions it issues a warning).

I think all this code is a bit redudant hence why I removed it. I think we can safely assume, or at least require that AR::Base.logger includes AS::LoggerSilence.

@rafaelfranca @Edouard-chin @etiennebarrie thoughts?

@rafaelfranca rafaelfranca merged commit f188efb into rails:master Jun 29, 2020
@denny
Copy link

denny commented Dec 7, 2020

Hi, will there be a release including this fix at some point?

@alaarab
Copy link

alaarab commented Dec 26, 2020

+1 for release. To get around this issue on Ruby 3.0.0, I had to specify master branch in my Gemfile:

gem "activerecord-session_store", git: "rails/activerecord-session_store", branch: "master"

@StoneGod
Copy link

Hi, what about release with this fix?

This was referenced Mar 9, 2021
suhiltzaile pushed a commit to bebanjo/activerecord-session_store that referenced this pull request Apr 12, 2021
@alecvn
Copy link

alecvn commented Jun 10, 2021

+1 for release. To get around this issue on Ruby 3.0.0, I had to specify master branch in my Gemfile:

gem "activerecord-session_store", git: "rails/activerecord-session_store", branch: "master"

I had to specify github like below for it to install properly:
gem "activerecord-session_store", github: "rails/activerecord-session_store", branch: "master"

@cezartiv
Copy link

May I ask why there isn't a release with this fix?

@casperisfine
Copy link
Author

May I ask why there isn't a release with this fix?

You can, but I can't answer your question.

However I can tell you that the 2.0.0 release from 18 months ago does contain this fix.

@sumirolabs sumirolabs mentioned this pull request Oct 31, 2023
@Charly3X
Copy link

Charly3X commented Nov 9, 2023

Rails 6.1
gem 'activerecord-session_store', '2.1.0'

error is still here...
RuntimeError (class variable @@Silencer of ActiveSupport::Logger is overtaken by Logger):

how to fix this?

@vnguyen13
Copy link

+1 for release. To get around this issue on Ruby 3.0.0, I had to specify master branch in my Gemfile:
gem "activerecord-session_store", git: "rails/activerecord-session_store", branch: "master"

I had to specify github like below for it to install properly: gem "activerecord-session_store", github: "rails/activerecord-session_store", branch: "master"

Thanks for this. This is what fixed it for me.

Rails 6.1, Ruby 3.1.2

@casperisfine casperisfine deleted the ruby-head-fixes branch May 24, 2024 06:30
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.

None yet

10 participants