Yup, have to declare them explicitly currently. Will dig into this, unsure when. Happy to consider pull requests though
Jets routing is built really from the ground up. It works pretty differently to account for API Gateway. So it’s doesn’t have a lot of the extras helpers like in the Rails routes yet. Would like them to be added over time. Happy to consider pull requests for this. One nice benefit is that I’m so hoping the implementation will simpler.
Hi @tung
Thank you for making this update. I think this may help me resolve #198.
In rails, I can use Rails.application.routes.url_helpers, what would be equivalent method in Jets?
I tried Jets.application.routes.url_helpers but that didn’t work
Interesting. An equivalent routes.url_helpers does not yet exist in Jets. Guessing you’re including it in models so you can use url helpers outside of views.
Will look at it in time. Will consider PRs for this.
Think I would start with the Jets::Router::Helpers module.
This contains Jets core and generated named routes helpers. Then would figure out how to include the ActionView helpers also.
FWIW, if all you need are the named routes helpers. include Jets::Router::Helpers may be enough for what you’re trying to do. Took a different approach with the Jets implementation. It “compiles” down routes code to generate the methods and doesn’t need to reference the view scope.