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

Fix NameError: uninitialized constant VandalUi #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nextekcarl
Copy link

Without this adjustment I get an error trying to load the last 2 released versions in a Rails 5.2 app. Perhaps there's somewhere else that needs to be adjusted instead?

@richmolj
Copy link
Contributor

richmolj commented Aug 7, 2020

Super odd. We're running Rails 5.2 without issue, and everywhere in the code I see a lowecase i. Any other details about the error? Maybe how you mounted in routes?

@nextekcarl
Copy link
Author

I just followed the details on the graphiti.dev page for Vandal. Add the vandal_ui gem. Bundle Install, then run the rake generator. Add the following lines from that page to the routes (minus the comment line):

scope path: ApplicationResource.endpoint_namespace, defaults: { format: :jsonapi } do
mount VandalUi::Engine, at: '/vandal'
end

Start rails server (we are using puma). Visit /api/v1/vandal and I see the page, but it just shows the grey background and the word Loading... See errors about various css not being found. Then I go to /api/v1/vandal/schema.json and I get a error page and in the logs I see:

Started GET "/api/v1/vandal/schema.json" for ::1 at 2020-08-07 15:52:55 -0700

LoadError - Unable to autoload constant VandalUI::SchemasController, expected /Users/carlanderson/dev/app_name_removed/vendor/bundle/ruby/2.6.0/gems/vandal_ui-0.4.5/app/controllers/vandal_ui/schemas_controller.rb to define it:

Started POST "/api/v1/vandal/__better_errors/cb5174db29813d9e/variables" for ::1 at 2020-08-07 15:52:55 -0700
Started GET "/api/v1/css/app.59d17783.css" for ::1 at 2020-08-07 15:55:04 -0700
Started GET "/api/v1/js/chunk-vendors.326f67bb.js" for ::1 at 2020-08-07 15:55:04 -0700
Started GET "/api/v1/css/chunk-vendors.e6a6ca22.css" for ::1 at 2020-08-07 15:55:04 -0700
Started GET "/api/v1/js/app.f85601e5.js" for ::1 at 2020-08-07 15:55:04 -0700

ActionController::RoutingError (No route matches [GET] "/api/v1/css/app.59d17783.css"):

And that goes away if I make the change to the exact casing it says it expects in the vendored gemfile. Though I still don't see anything in the list on the left, though we have our first Resource added and working (testing via Postman). I'd like to get Vandal working, but it isn't critical to our usage.

@nextekcarl
Copy link
Author

I'm on Max OSX Catalina, BTW.

@richmolj
Copy link
Contributor

richmolj commented Aug 8, 2020

And that goes away if I make the change to the exact casing it says it expects in the vendored gemfile

I think this may be the issue...any chance your app has an old version of vandal somehow vendored? Somehow seems things got into a bad state...you'll not in GH this project has the lowercase i in the gemspec and everywhere else. I just ran the quickstart and didn't have an issue. Can you remove/update whatever is vendored?

@nextekcarl
Copy link
Author

Thanks for your help. Turns out the problem is project specific. 🤦 Someone a few years ago added inflect.acronym 'UI' to the inflections.rb file and I didn't think to check it until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants