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
What type of behaviour would you want in this case? I think an empty string is a good return value in this case which would then leave you to check if the return is empty (which you probably should be checking anyway). The alternative would be to return nil if the string is empty but I think a contract of String in String out for #to_url is a better pattern.
nope, absolutely fine. I'll just add a custom validation to check whether the generated permalink is not valid and add an error to the 'name' (since the user will never directly enter a permalink and might need a useful description why his 'name' isn't valid)
is there any good workaround for edge cases such as an input value of "???" which will be turned into the empty string "" by the
to_url
methodThose should be avoided, as rails cannot handle it as an id to search by.
best regards,
Lennart
The text was updated successfully, but these errors were encountered: