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
{{ message }}
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
What if a parameter is not provided? In the RFC it is handled like this:
A variable that is undefined (Section 2.3) has no value and is ignored by the expansion process. If all of the variables in an expression are undefined, then the expression's expansion is the empty string.
I don’t think that makes a lot of sense for this use case here, as broken URLs can arise. It probably should be handled differently for different kinds of parameters, maybe like this:
test'route with a missing regular parameter'do |routes|
routes.define:users,'/users/{id}'assert_raise(ArgumentError){routes.uri_for(:users)}endtest'route with a missing query parameter'do |routes|
routes.define:users,'/users{?name,country}'assert_equal'/users?name=alice',routes.uri_for(:users,name: 'alice')endtest'route with a missing path parameter'do |routes|
routes.define:users,'/users{/x,y}'assert_raise(ArgumentError){routes.uri_for(:users,x: 'alice')}end
The text was updated successfully, but these errors were encountered:
I don’t think that makes a lot of sense for this use case here, as broken URLs can arise.
I agree with you: for anything that helps build the path (first and third tests in your example), an error should be raised. What is mentioned in the RFC should only apply to the second test, but in any case we can keep an eye on this to see what's the most common expectation based on our use cases.
What if a parameter is not provided? In the RFC it is handled like this:
I don’t think that makes a lot of sense for this use case here, as broken URLs can arise. It probably should be handled differently for different kinds of parameters, maybe like this:
The text was updated successfully, but these errors were encountered: