tfwright
With the change away from helpers to verified routes, I’m wondering if/how it is possible to invoke a route without knowing the full path including scopes, which was one of the uses of named helpers?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
josevalim
Can you provide an example? Even before, you had to know the name. So if you have some sort of contract, where you were like, give me a module name and it should have this helper, you can still define said contract using functions that returns a verified route (which is just a string anyway),
tfwright
Sure, I am using the named helper without knowing the rest of the routes here: live_admin/lib/live_admin/view.ex at 5d96eee465ed64dcb90eb616aa55537189beb0e6 · tfwright/live_admin · GitHub
Currently, that returns a path like
/admin/my_resourcewith needing to know about theadminscope in the router the route was defined in. My understanding that the path using verified routes would need to be something like ~p"/admin/#{my_resource}"?BartOtten
This does not answer the question literally, but might present a solution to the problem you are facing.
Your lib seems to accept a scope as option to the macro so this should be possible to generate using the macro:
Then you combine a path-less function call with routes verified at compile time.
ps. if you know the resources during compile time too, you can generate more specific function clauses.
tfwright
True, and that part of the scope I can handle, but it’s also possible that the routes were defined in other scopes above it, and I’m not sure where to get those.
BartOtten
I don’t see how that issue can be solved without some rewriting of your macro. Wonder where José comes up with (or not).
Currently writing a lib which hooks into the Router using _before compilation_ and is able to write helpers using all information known about routes (including resolved nested scope paths). Copied some docs already to this forum, see paragraph Powerful but thin as it includes some pointers where you could look at.
If you pass me your email by PM I can grand you access to the still private repo and you can let it inspire you (or decide that writing an extension is actually easier ;))
tfwright
I dug around in the phoenix_live_dashboard source, since it is mounted using almost the exact same strategy (because I shamelessly copied it), and it looks like it takes advantage of a function that looks like it was added in 1.7: Phoenix.Router.scoped_path/2
AFAICT it does exactly what I need–it returns the full path to the current scope, so by invoking it inside the macro I can grab and store the prefix to use when building my routes.
tfwright
And for anyone else that needs to do something similar, I adapted a combination of the LiveDashboard/Phoenix 1.7 helpers to remove the dependency on named helpers from my app without requiring 1.7: Remove router helpers dependency · tfwright/live_admin@56a3149 · GitHub