You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/routing.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -198,14 +198,17 @@ Using `~p` for route paths ensures our application paths and URLs stay up to dat
198
198
199
199
### More on verified routes
200
200
201
-
What about paths with query strings? You can either add query string key values directly, or provide a dictionary of key-value pairs, for example:
201
+
What about paths with query strings? You can add query string key values directly, as a keyword list or map of values, for example:
202
202
203
203
```elixir
204
204
~p"/users/17?admin=true&active=false"
205
205
"/users/17?admin=true&active=false"
206
206
207
207
~p"/users/17?#{[admin:true]}"
208
208
"/users/17?admin=true"
209
+
210
+
~p"/users/17?#{%{admin:true}}"
211
+
"/users/17?admin=true"
209
212
```
210
213
211
214
What if we need a full URL instead of a path? Just wrap your path with a call to `Phoenix.VerifiedRoutes.url/1`, which is imported everywhere that `~p` is available:
0 commit comments