You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At least in my case that was because I am using Puma with threads. I'm not sure why, but this piece of code uses thread-local-storage members to enable footnotes:
Changing thread_mattr_accessor to mattr_accessor fixed it for me.
I am far from a Ruby expert, but this monkey-patch in config/initializers/rails_footnotes.rb worked for me:
moduleFootnotes# the original implementation uses thread_mattr_accessor which doesn't work well with puma.# puma creates multiple threads and each of them has a different value for the same variable.# Footnotes.setup below only happens on the main thread and the value is NOT shared.# this code below is a workaround to make it work with puma.mattr_accessor:before_hooks,default: []mattr_accessor:after_hooks,default: []mattr_accessor:enabled,default: falseendFootnotes.setupdo |f|
f.enabled=Rails.env.development?end
ruby 3.2.3
rails 7.1.3.2
rails-footnotes 7.1.0
rails_footnotes.rb
Footnotes.setup do |f|
f.enabled = Rails.env.development?
end if defined?(Footnotes) && Footnotes.respond_to?(:setup)
I start app in development mode, and nothing happens and nothing appears(
I tried add div in layout with id="footnotes_holder"
but it empty always(
There are no errors, but nothing happens.
The text was updated successfully, but these errors were encountered: