-
Notifications
You must be signed in to change notification settings - Fork 83
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
Loading order is causing issues #144
Comments
Thanks for reporting this, and sorry you're having problems. I'll take a look shortly and try to reproduce what you're seeing. |
@sobrinho I'd like to make sure that I'm seeing the same thing you're seeing. This is my repro script: #! /usr/bin/env ruby
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "actionview"
end
require "rails-html-sanitizer"
require "action_view"
class Foo
include ActionView::Helpers::SanitizeHelper
end
puts Foo.new.sanitize("hello") which results in:
but if I comment out Have I reproduced what you're seeing? |
I think your analysis is correct: when You shouldn't need to explicitly |
@flavorjones Our current work around is that we created an initializer for action view with |
OK. Regardless, this method of monkeypatching core classes is problematic. I'll reach out to Rails core and ask them if there is a "right" way to do this. It might be interesting to investigate why |
After a brief chat, it seems like the right decision is to move these methods upstream into Actionview. I'll take care of that. |
@rafaelfranca It looks like commit 2dbd320 (and rails/rails@67b42cb) moved these methods out of ActionView and into this gem. Can you help me understand why they were originally moved here? |
hmmm, let me try to remember. I think I had the impression that we might want to change implementation later on and not have specific behavior of this gem in Action View. I think we can move it back. |
@sharvy expressed an interest in working on cleaning this up. Still interested? |
This works:
This doesn't:
In a real world app, sidekiq loads the files in the correct order but when using sidekiqswarm it doesn't.
Although, I don't see anything special with sidekiqswarm other than its forking machinery there.
Is this something we can fix here?
The current workaround is to require the action view in a initializer to make sure it loaded:
The problem is that this gem is defining the module here: https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails-html-sanitizer.rb#L30-L32
And possible we are using autoloading inside rails which doesn't require the file.
The text was updated successfully, but these errors were encountered: