We've moved discussions to Discord

admin_root_path in docs not working?

Luke Gilliam
Hi. I have a new install of Jumpstart Pro on Rails 6.0.2.2 and Ruby 2.7.1p83. When I try to access the Admin link on the docs page, I get this:

undefined local variable or method `admin_root_path' for #<#<Class:0x00007fd1e1dc8420>:0x00007fd1e48daa28>

app.admin_root_path returns /admin in the console, and that's about the limit of my debugging skills for Rails views helpers. Accessing the URL directly at http://localhost:5000/admin does work.

Any suggestions?

Chris Oliver
Can share paste the full stacktrace?
Luke Gilliam
 lib/jumpstart/app/views/jumpstart/docs/admin.html.erb:11
 actionview (6.0.2.2) lib/action_view/base.rb:274:in `_run'
 actionview (6.0.2.2) lib/action_view/template.rb:185:in `block in render'
 activesupport (6.0.2.2) lib/active_support/notifications.rb:182:in `instrument'
 actionview (6.0.2.2) lib/action_view/template.rb:386:in `instrument_render_template'
 actionview (6.0.2.2) lib/action_view/template.rb:183:in `render'
 actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:59:in `block (2 levels) in render_template'
 actionview (6.0.2.2) lib/action_view/renderer/abstract_renderer.rb:89:in `block in instrument'
 activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `block in instrument'
 activesupport (6.0.2.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `instrument'
 actionview (6.0.2.2) lib/action_view/renderer/abstract_renderer.rb:88:in `instrument'
 actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:58:in `block in render_template'
 actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
 actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:57:in `render_template'
 actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:13:in `render'
 actionview (6.0.2.2) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 actionview (6.0.2.2) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 actionview (6.0.2.2) lib/action_view/rendering.rb:118:in `block in _render_template'
 actionview (6.0.2.2) lib/action_view/base.rb:304:in `in_rendering_context'
 actionview (6.0.2.2) lib/action_view/rendering.rb:117:in `_render_template'
 actionpack (6.0.2.2) lib/action_controller/metal/streaming.rb:219:in `_render_template'
 actionview (6.0.2.2) lib/action_view/rendering.rb:103:in `render_to_body'
 actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 actionpack (6.0.2.2) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 actionpack (6.0.2.2) lib/abstract_controller/rendering.rb:25:in `render'
 actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:36:in `render'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
 activesupport (6.0.2.2) lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
 /Users/lukegilliam/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
 activesupport (6.0.2.2) lib/active_support/core_ext/benchmark.rb:14:in `ms'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:85:in `cleanup_view_runtime'
 activerecord (6.0.2.2) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
 turbolinks_render (0.9.17) lib/turbolinks_render/rendering.rb:8:in `render'
 actionpack (6.0.2.2) lib/action_controller/metal/implicit_render.rb:35:in `default_render'
 actionpack (6.0.2.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 actionpack (6.0.2.2) lib/abstract_controller/base.rb:196:in `process_action'
 actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
 actionpack (6.0.2.2) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 activesupport (6.0.2.2) lib/active_support/callbacks.rb:135:in `run_callbacks'
 actionpack (6.0.2.2) lib/abstract_controller/callbacks.rb:41:in `process_action'
 actionpack (6.0.2.2) lib/action_controller/metal/rescue.rb:22:in `process_action'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `block in instrument'
 activesupport (6.0.2.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `instrument'
 actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 actionpack (6.0.2.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 activerecord (6.0.2.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 actionpack (6.0.2.2) lib/abstract_controller/base.rb:136:in `process'
 actionview (6.0.2.2) lib/action_view/rendering.rb:39:in `process'
 actionpack (6.0.2.2) lib/action_controller/metal.rb:191:in `dispatch'
 actionpack (6.0.2.2) lib/action_controller/metal.rb:252:in `dispatch'
 actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:51:in `dispatch'
 actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:33:in `serve'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `each'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `serve'
 actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:837:in `call'
 railties (6.0.2.2) lib/rails/engine.rb:526:in `call'
 railties (6.0.2.2) lib/rails/railtie.rb:190:in `public_send'
 railties (6.0.2.2) lib/rails/railtie.rb:190:in `method_missing'
 actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
 actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:48:in `serve'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `each'
 actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `serve'
 actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:837:in `call'
 warden (1.2.8) lib/warden/manager.rb:36:in `block in call'
 warden (1.2.8) lib/warden/manager.rb:34:in `catch'
 warden (1.2.8) lib/warden/manager.rb:34:in `call'
 rack (2.2.2) lib/rack/tempfile_reaper.rb:15:in `call'
 rack (2.2.2) lib/rack/etag.rb:27:in `call'
 rack (2.2.2) lib/rack/conditional_get.rb:27:in `call'
 rack (2.2.2) lib/rack/head.rb:12:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 rack (2.2.2) lib/rack/session/abstract/id.rb:266:in `context'
 rack (2.2.2) lib/rack/session/abstract/id.rb:260:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/cookies.rb:648:in `call'
 activerecord (6.0.2.2) lib/active_record/migration.rb:567:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 activesupport (6.0.2.2) lib/active_support/callbacks.rb:101:in `run_callbacks'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 web-console (4.0.1) lib/web_console/middleware.rb:132:in `call_app'
 web-console (4.0.1) lib/web_console/middleware.rb:28:in `block in call'
 web-console (4.0.1) lib/web_console/middleware.rb:17:in `catch'
 web-console (4.0.1) lib/web_console/middleware.rb:17:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 turbolinks_render (0.9.17) lib/turbolinks_render/middleware.rb:77:in `call'
 railties (6.0.2.2) lib/rails/rack/logger.rb:38:in `call_app'
 railties (6.0.2.2) lib/rails/rack/logger.rb:26:in `block in call'
 activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:80:in `block in tagged'
 activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:28:in `tagged'
 activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:80:in `tagged'
 railties (6.0.2.2) lib/rails/rack/logger.rb:26:in `call'
 sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 request_store (1.5.0) lib/request_store/middleware.rb:19:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/request_id.rb:27:in `call'
 rack (2.2.2) lib/rack/method_override.rb:24:in `call'
 rack (2.2.2) lib/rack/runtime.rb:22:in `call'
 activesupport (6.0.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/static.rb:126:in `call'
 rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
 actionpack (6.0.2.2) lib/action_dispatch/middleware/host_authorization.rb:77:in `call'
 webpacker (4.2.2) lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
 rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call'
 railties (6.0.2.2) lib/rails/engine.rb:526:in `call'
 puma (4.3.3) lib/puma/configuration.rb:228:in `call'
 puma (4.3.3) lib/puma/server.rb:682:in `handle_request'
 puma (4.3.3) lib/puma/server.rb:472:in `process_client'
 puma (4.3.3) lib/puma/server.rb:328:in `block in run'
 puma (4.3.3) lib/puma/thread_pool.rb:134:in `block in spawn_thread' 
Chris Oliver
Rails engines work differently than the normal routes. They're nested inside a gem, so they don't interfere with the main app routes.

That route in the docs should have been main_app.admin_root_path to account for the Rails engine.

Just fixed that in master. Gets a bit confusing working in an engine sometimes! 
Luke Gilliam
Hi, Chris. That fixed it and also gave me an opportunity to test merging in updates from Jumpstart.

Thanks!
Chris Oliver
Perfect! Two 🦜with one 💎haha!
Notifications
You’re not receiving notifications from this thread.