Skip to content
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

LoadError: no such file to load -- helpers/primer/form_helper #2359

Closed
agardiner opened this issue Nov 3, 2023 · 1 comment
Closed

LoadError: no such file to load -- helpers/primer/form_helper #2359

agardiner opened this issue Nov 3, 2023 · 1 comment
Labels
bug Something isn't working rails

Comments

@agardiner
Copy link

With the 0.13.2 version of the primer_view_components gem, I get a LoadError on first access of any page of my app:

Puma caught this error: no such file to load -- helpers/primer/form_helper (LoadError)
org/jruby/RubyKernel.java:1071:in 'require'
.../lib/ruby/gems/shared/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38:in 'require'
.../lib/ruby/gems/shared/gems/primer_view_components-0.13.2/lib/primer/view_components/engine.rb:47:in 'block in Engine'

The error is due to a require that uses an incorrect path to the form_helper.

      initializer "primer.forms.helpers" do
        ActiveSupport.on_load :action_controller_base do
 --->     require "helpers/primer/form_helper"
          helper Primer::FormHelper

          # make primer_form_with available to view components also
          ViewComponent::Base.prepend(Primer::FormHelper)
        end
      end

The correct helpers folder location is actually added to the eager_load_paths earlier in the engire:

      config.eager_load_paths = %W[
        #{root}/app/components
        #{root}/app/forms
        #{root}/app/helpers
        #{root}/app/lib
      ]

Therefore, simply removing the require on line 47 fixes the issue.

@lesliecdubs lesliecdubs added the bug Something isn't working label Nov 3, 2023
@safeforge
Copy link
Contributor

Fixed by #2336

@jonrohan jonrohan closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rails
Projects
None yet
Development

No branches or pull requests

4 participants