Make URL for a GET route. An error will be raised if the route doesn't exist.
urlFor.get('users.show', [1]) // { method: 'get', url: '/users/1' }
urlFor.get('users.store', [1]) // Error: Route not found GET@users/store
Make URL for a POST route. An error will be raised if the route doesn't exist.
urlFor.post('users.store') // { method: 'post', url: '/users' }
urlFor.post('users.show', [1]) // Error: Route not found POST@users.show
Make URL for a PUT route. An error will be raised if the route doesn't exist.
urlFor.put('users.update', [1]) // { method: 'put', url: '/users/1' }
urlFor.put('users.show', [1]) // Error: Route not found PUT@users.show
Make URL for a PATCH route. An error will be raised if the route doesn't exist.
urlFor.put('users.update', [1]) // { method: 'patch', url: '/users/1' }
urlFor.put('users.show', [1]) // Error: Route not found PATCH@users.show
Make URL for a DELETE route. An error will be raised if the route doesn't exist.
urlFor.delete('users.destroy', [1]) // { method: 'delete', url: '/users/1' }
urlFor.delete('users.show', [1]) // Error: Route not found DELETE@users.show
Make URL for a custom route method. An error will be raised if the route doesn't exist for the same method.
The urlFor helper is used to make URLs for pre-existing known routes. You can make a URL using the route name, route pattern, or the route controller reference (depends upon enabled lookupStrategies)