pry-rails
pry-rails copied to clipboard
A few cases recognize-path doesn't handle.
Doesn't work:
http://example.com/foo/bar (routes a 404).
foo/bar (routes as 404).
Works fine:
/foo/bar
/cc @kyrylo
For the URL I don't think it should try to match anything from the domain but just take the path & use that.
foo/bar
doesn't work by design.
http://example.com/foo/bar
doesn't work because you specified the protocol. Yeah, it's not smart enough to detect whether you provided a protocol or not. It just automatically appends it. So it should be example.com/foo/bar
instead.
@kyrylo can pry-rails not handle the cases Rails cannot? I copy+paste from my URL all the time, and I don't consult RFCs beforehand. I think it's not hard to handle these cases, they're very easy to solve before passing to the Rails API.
I'm thinking of something like this for the first case:
unless fragment.starts_with? "/"
warn "Prepending / to #{fragment}"
fragment.prepend "/"
end
For the second case:
fragment = URI.parse(fragment).path rescue fragment
Why not? Looks good to me. I had borne in mind these possible extensions to the command when I worked on it. However, I decided to make it as simple as it can be, because I wasn't sure the patch would be accepted.
@kyrylo ah I see. okay. should I make the pull request, or you? :-D I'd love for those cases to be handled because anytime I use the recongize-path
command I'm copying from a browser's URL bar or somewhere like that. It'd be nice to copy+paste & it "just works".
Sure, it would be cool, go for it. You're probably the most active recognize-path
user :-P
added to the never ending list ;-)