Upgrading to 0.2.0 makes app unlaunchable, Zeitwerk-related, stupid hack enclosed #113
Closed
Description
Whattup? So. I'm working with Rails 7.0.2.2, Ruby 3.1.1. I updated to ViewComponent-Form 0.2.0 and then I got:
dazmin@Desmonds-MacBook-Pro tmp % rake zeitwerk:check
(in /Users/dazmin/RubymineProjects/omm)
rake aborted!
NameError: uninitialized constant ViewComponent::Form
loader.push_dir("#{__dir__}/form", namespace: ViewComponent::Form)
^^^^^^
/Users/dazmin/RubymineProjects/omm/config/application.rb:7:in `<top (required)>'
/Users/dazmin/RubymineProjects/omm/Rakefile:4:in `require_relative'
/Users/dazmin/RubymineProjects/omm/Rakefile:4:in `<top (required)>'
Caused by:
LoadError: cannot load such file -- view_component-form
/Users/dazmin/RubymineProjects/omm/config/application.rb:7:in `<top (required)>'
/Users/dazmin/RubymineProjects/omm/Rakefile:4:in `require_relative'
/Users/dazmin/RubymineProjects/omm/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
dazmin@Desmonds-MacBook-Pro tmp %
Which is bad. I flailed around for a while and ended up with this quite stupid hack that works. dhnaranjo@21d9b46. Short version, since the constant ain't initialized I initialized it.
# /lib/view_component/form.rb
require "view_component"
require "zeitwerk"
+ module ViewComponent
+ module Form
+ end
+ end
loader = Zeitwerk::Loader.for_gem
form = "#{__dir__}/form.rb"
loader.ignore(form)
Anyways, I got no idea how to actually resolve it or I'd happily make a PR. This solution of mine seems too dumb to be proper.
Metadata
Assignees
Labels
No labels