Skip to content

helper Primer::FormHelper is incompatible with Rails 7+ config #3814

@mariaaxime

Description

@mariaaxime

We're trying to move to the Rails 7+ default config where add_autoload_paths_to_load_path = false. However when we do that we get a NameError

NameError: uninitialized constant Primer::FormHelper (NameError)

           helper Primer::FormHelper
                        ^^^^^^^^^^^^
/app/bundle/ruby/3.4.0/gems/primer_view_components-0.48.0/lib/primer/view_components/engine.rb:56:in 'block (2 levels) in <class:Engine>'

which seems to be coming from here
https://github.com/primer/view_components/blob/main/lib/primer/view_components/engine.rb#L49-L61

removing the begin/rescue block and adding require_relative "../../../app/helpers/primer/form_helper" to the top of the file seems to fix it. but it's still confusing considering app/helpers is on the eager load config here https://github.com/primer/view_components/blob/main/lib/primer/view_components/engine.rb#L19

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions