Skip to content

Loading order is causing issues #144

Open
@sobrinho

Description

@sobrinho

This works:

gem "actionview", "6.0.3.2"
gem "rails-html-sanitizer", "1.4.3"

require "action_view"
require "rails-html-sanitizer"

include ActionView::Helpers::SanitizeHelper

puts sanitize "hello"

This doesn't:

gem "actionview", "6.0.3.2"
gem "rails-html-sanitizer", "1.4.3"

require "rails-html-sanitizer"
require "action_view"

include ActionView::Helpers::SanitizeHelper

puts sanitize "hello"

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:

$ cat config/initializers/00_action_view.rb
require 'action_view/helpers/sanitize_helper'

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions