问题标签 [hanami-router]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby - 如何使用带有 Rack::Builder::map 的 Lotus 路由器
有没有办法一起使用地图和(莲花)路由器命名空间?下面是config.ru
我试图作为演示运行的示例。
hanami - Hanami 路线助手在模板中不起作用
我有 hanami 应用程序版本 1.0.0 我有下一个 routes.rb 文件:
我阅读了文档并尝试使用
在 application.html.erb 模板中,但收到下一个错误:
Hanami::Routing::InvalidRouteException: No route (path) could be generated for :games - 请检查给定的参数
如何在 hanami 模板中使用路由器?
ruby - How to get the `hanami routes` command to include additional objects
The overview documentation for routes has examples of objects being used for route resolution such as get '/rack-app', to: RackApp.new
, which work as documented with code like:
From the console and the server commands, everything does what I expect, however, when executing the command hanami routes
, I get the following error:
The problem is that the routes
command is not loading the entire application (which is good) but also problematic. I originally tried using require_relative
from routes.rb
but since the file is eval'ed this fails miserably, besides feeling wrong.
I'm trying to figure how to get this class definition included for the routes
command in a way that's most consistent with Hanami itself.
ruby - Hanami:从视图或模板访问当前页面 URL
那些日子我正在发现 Hanami(Hanami 1.3),我正在完善我从事的测试项目,但我找不到从视图或模板访问当前页面 url/路径的方法(这个想法正在处理导航链接的视觉状态,您可能已经猜到了)。
我试图猜测助手的名字(routes.current_page
, routes.current_url
, routes.current
...),但我并不走运。我检查了路由助手文档,通过了hanami/hanami和hanami/router存储库,但没有找到我想要的东西。
我错过了什么还是这根本不是内置的?