Skip to content

Commit

Permalink
init class attrs with mutable arrays not frozen
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Dec 4, 2023
1 parent 935b0c3 commit bc4c801
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/rails-footnotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
require 'rails-footnotes/extension'

module Footnotes
thread_mattr_accessor :before_hooks, default: []
thread_mattr_accessor :after_hooks, default: []
thread_mattr_accessor :before_hooks
thread_mattr_accessor :after_hooks
thread_mattr_accessor :enabled, default: false

class << self
Expand Down Expand Up @@ -59,6 +59,9 @@ def self.setup
end
end

Footnotes.before_hooks = []
Footnotes.after_hooks = []

ActiveSupport.on_load(:action_controller) do
ActionController::Base.send(:include, Footnotes::RailsFootnotesExtension)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/rails-footnotes/notes/log_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ class LogNote < AbstractNote

autoload :NoteLogger, 'rails-footnotes/notes/log_note/note_logger'

thread_cattr_accessor :logs, default: []
thread_cattr_accessor :logs
thread_cattr_accessor :original_logger

def self.start!(controller)
self.logs = []
self.original_logger = Rails.logger
note_logger = NoteLogger.new(self.logs)
note_logger.level = self.original_logger.level
Expand Down

0 comments on commit bc4c801

Please sign in to comment.