Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edge case handling #12

Closed
lennart opened this issue Aug 25, 2010 · 2 comments
Closed

edge case handling #12

lennart opened this issue Aug 25, 2010 · 2 comments

Comments

@lennart
Copy link

lennart commented Aug 25, 2010

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 method

Those should be avoided, as rails cannot handle it as an id to search by.

best regards,

Lennart

@pdlug
Copy link
Contributor

pdlug commented Aug 25, 2010

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.

@lennart
Copy link
Author

lennart commented Aug 25, 2010

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)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants