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

README request - include example using URI.regexp #73

Closed
floer32 opened this issue Oct 10, 2016 · 1 comment
Closed

README request - include example using URI.regexp #73

floer32 opened this issue Oct 10, 2016 · 1 comment

Comments

@floer32
Copy link

floer32 commented Oct 10, 2016

Since it seems like something that might come up here and there, maybe it would be good to show a format example with URI.regexp. It seems simple, but to a Ruby newb like me (coming from Python), this was a little A-ha! Nice! moment... I mean, it's not necessary but it is a common use case anyway (pretty common for someone to put in a URL into a form, linking accounts etc.) ... yeah, why not show an easy case.

Totally understand if this seems gratuitous just figured I'd suggest it and throw up a PR.

@floer32 floer32 closed this as completed Oct 10, 2016
@floer32 floer32 reopened this Oct 10, 2016
adrianbn pushed a commit to adrianbn/sinatra-param2 that referenced this issue Jun 4, 2017
adrianbn added a commit to adrianbn/sinatra-param2 that referenced this issue Jun 4, 2017
@mattt
Copy link
Owner

mattt commented Mar 20, 2018

This is indeed a cool use of existing functionality, and one that I hadn't considered previously. Thanks for sharing, @hangtwenty.

As for whether this should go in the README, that's hard to say. I'm leaning towards not for the following reasons:

  • It requires an extra require
  • It doesn't seem to fit with the current example of a search endpoint
  • Referrers are typically sent as an HTTP header, rather than in the URL query
  • Matching URI.regexp doesn't actually imply that a valid URL; most HTTP implementations limit the length of a URL to 2038 characters, however the following statement still returns true: URI.regexp.match? "http://a.com/" + ("a" * 5000)

All of that said, I think the documentation could do a better job of explaining how one might initialize domain or model objects from parameters, and what the relationship is there. I'm looking into how this could be improved in a future version.

@mattt mattt closed this as completed Mar 20, 2018
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