-
Notifications
You must be signed in to change notification settings - Fork 445
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
uninitialized constant ViewComponent #1972
Comments
Seems the generator is broken as well:
As it returns the following error:
Could it be an issue with the autoloading of the gem? |
So I fixed it by adding However I don't see any mention of having to do this in the installation guide... unless I missed it? Would seem there's some auto load failing and then it requiring a manual load as I've done here. |
no need to add |
Hi @iamdriz that's weird. Can you double check the version of view_component in Gemfile.lock? Also, are you using the classic or zeitwerk mode? (See this guide) |
@iamdriz do you have any further feedback on this issue, so that we know if this is still a bug on the view_component side or not |
@Spone Its 3.10.0. I've not specified a version and I'm running Rails 6.1 so it should be defaulting to zeitwork in 6. It's defo loading the defaults from 6.1 as I have this in my I also just ran: @iamdriz No I'm still having to manually require view_component in the |
I'm looking at updating the app to 7.1 soon so will see if that fixes the issue. |
Did upgrading to 7.1 fix for you?
|
@iamdriz any further feedback |
Expected behavior
Installed
view_component
in the Gemfile (so it's definitely installed). And should be able to create components.Actual behavior
ViewComponent doesn't seem to be being loaded in Rails as we get
uninitialized constant ViewComponent
Not really sure where the problem is and what to try next... uninstalled the gem and re-installed it but same error.
Backtrace:
System configuration
Rails version: 6.1.7.6
Ruby version: 3.2.2
Gem version: 3.10.0
The text was updated successfully, but these errors were encountered: