Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 未定义的方法'api_path';对于#<;ActionDispatch::Routing::RouteProxy>;_Ruby On Rails_Ruby_Rails Api - Fatal编程技术网

Ruby on rails 未定义的方法'api_path';对于#<;ActionDispatch::Routing::RouteProxy>;

Ruby on rails 未定义的方法'api_path';对于#<;ActionDispatch::Routing::RouteProxy>;,ruby-on-rails,ruby,rails-api,Ruby On Rails,Ruby,Rails Api,访问rails项目中的页面时出现以下错误- ActionView::Template::Error (undefined method `api_path' for #<ActionDispatch::Routing::RoutesProxy:0x00008e561044gs42>): 附加错误跟踪以获得更多澄清- actionpack (4.2.11.3) lib/action_dispatch/routing/routes_proxy.rb:37:in `method_mis

访问rails项目中的页面时出现以下错误-

ActionView::Template::Error (undefined method `api_path' for #<ActionDispatch::Routing::RoutesProxy:0x00008e561044gs42>):
附加错误跟踪以获得更多澄清-

 actionpack (4.2.11.3) lib/action_dispatch/routing/routes_proxy.rb:37:in `method_missing'
  engines/app/app/views/app/sidenav/_profile_menu.html.haml:11:in `_engines_app_app_views_app_sidenav__profile_menu_html_haml__3594012503633114979_69941412451100'
  actionview (4.2.11.3) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:166:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:337:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:143:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:309:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:51:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:25:in `render'
  actionview (4.2.11.3) lib/action_view/helpers/rendering_helper.rb:32:in `render'
  haml (5.2.1) lib/haml/helpers/action_view_mods.rb:13:in `block in render'
  haml (5.2.1) lib/haml/helpers.rb:93:in `non_haml'
  haml (5.2.1) lib/haml/helpers/action_view_mods.rb:13:in `render'
  engines/app/app/views/app/sidenav/_customer_nav.html.haml:36:in `_engines_app_app_views_app_sidenav__customer_nav_html_haml__1429088226201557624_69941420498620'
  actionview (4.2.11.3) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:166:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:337:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:143:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:309:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:51:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:25:in `render'
  actionview (4.2.11.3) lib/action_view/helpers/rendering_helper.rb:32:in `render'

如果有人知道如何解决此错误,请提供帮助。

能否请您共享
config/routes.rb
文件中定义API路由的部分。
 actionpack (4.2.11.3) lib/action_dispatch/routing/routes_proxy.rb:37:in `method_missing'
  engines/app/app/views/app/sidenav/_profile_menu.html.haml:11:in `_engines_app_app_views_app_sidenav__profile_menu_html_haml__3594012503633114979_69941412451100'
  actionview (4.2.11.3) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:166:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:337:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:143:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:309:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:51:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:25:in `render'
  actionview (4.2.11.3) lib/action_view/helpers/rendering_helper.rb:32:in `render'
  haml (5.2.1) lib/haml/helpers/action_view_mods.rb:13:in `block in render'
  haml (5.2.1) lib/haml/helpers.rb:93:in `non_haml'
  haml (5.2.1) lib/haml/helpers/action_view_mods.rb:13:in `render'
  engines/app/app/views/app/sidenav/_customer_nav.html.haml:36:in `_engines_app_app_views_app_sidenav__customer_nav_html_haml__1429088226201557624_69941420498620'
  actionview (4.2.11.3) lib/action_view/template.rb:145:in `block in render'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:166:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:337:in `instrument'
  actionview (4.2.11.3) lib/action_view/template.rb:143:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.11.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.11.3) lib/active_support/notifications.rb:164:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
  actionview (4.2.11.3) lib/action_view/renderer/partial_renderer.rb:309:in `render'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:51:in `render_partial'
  actionview (4.2.11.3) lib/action_view/renderer/renderer.rb:25:in `render'
  actionview (4.2.11.3) lib/action_view/helpers/rendering_helper.rb:32:in `render'