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

In Browser Path Matching with Javascript #9001

Merged
merged 1 commit into from Jan 21, 2013

Conversation

schneems
Copy link
Member

When debugging routes it can sometimes be difficult to understand exactly how the paths are matched. This PR adds a JS based path matching widget to the /rails/info/routes output. You can enter in a path, and it will tell you which of the routes that path matches, while preserving order (top match wins).

The matching widget in action:

Prior to this PR the only way to check matching paths is via mental math, or typing in a path in the url bar and seeing where it goes. This feature will be an invaluable debugging tool by dramatically decreasing the time needed to check a path match.

To newcomers: you can run this route page in Rails 3.2 (without this feature), using Sextant.

It has also been noted that this PR is: OVER 9000.

ATP actionpack

@mdespuits
Copy link

Wow. Just Wow. 👍

@Jauny
Copy link

Jauny commented Jan 19, 2013

yea just wow, amazing 👍

@Antiarchitect
Copy link
Contributor

Like! 👍

@frodsan
Copy link
Contributor

frodsan commented Jan 19, 2013

Awesome 👍

@kaievns
Copy link

kaievns commented Jan 19, 2013

$ rails routes | grep foo

but generally looks like fun :)

@h3h
Copy link

h3h commented Jan 19, 2013

👍

}

// Ensure path always starts with a slash "/" and remove params or fragments
function sanatizePath(path) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanitizePath for the greater spelling win. 😄

@goshacmd
Copy link
Contributor

👍

@Jacke
Copy link

Jacke commented Jan 19, 2013

👍 Awesome!!

@drnic
Copy link
Contributor

drnic commented Jan 19, 2013

A very appropriate PR for #9001!

@aviflombaum
Copy link

dude, killer. 👍 its like better_errors for routes :-)

@jrgifford
Copy link
Contributor

does this work in production? That's the only question I have. (i will admit i haven't looked at the code for this.)

@schneems
Copy link
Member Author

@jrgifford you cannot access this url in production, it is in an internal controller only added in development, and there is a before filter that will prevent anyone from accessing this page unless it is a local request.

@shedd
Copy link

shedd commented Jan 19, 2013

Fantastic idea!

@hankblinq
Copy link

Clap Clap Clap!

@jrgifford
Copy link
Contributor

@schneems ah, ok. excellent!

@mmay
Copy link

mmay commented Jan 20, 2013

👍

@thenickcox
Copy link
Contributor

Here's to hoping we use the ability to use animated GIFs in pull requests for good, not for annoying.

@codeblooded
Copy link

👍 Yeah!!!

@BMorearty
Copy link
Contributor

❤️

@jfairchild
Copy link

👍

@jgaskins
Copy link
Contributor

@drnic This PR is, indeed, over 9000.

@pacoguzman
Copy link
Contributor

🤘

@route = route
super(@route)
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that you're capturing the route for the regex method below? If so can't we delete this method and implement regex like this:

def regex
  __get_object__.path.to_regexp
end

Also can we keep the names consistent - use regexp instead of regex.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, i had never worked with SimpleDelegator before, looks like it's __getobj__

@calebhearth
Copy link
Contributor

@schneems What did you use to make the gif?

@lukeholder
Copy link

@brndnblck
Copy link

very nice

@iampeter
Copy link

👍

@flexoid
Copy link
Contributor

flexoid commented Jan 24, 2013

That's just awesome! 👍

@miguelff
Copy link

Awesome! ❤️

@pedrosnk
Copy link
Contributor

lovely

@sir-pinecone
Copy link

👍 👍 👍

@bsodmike
Copy link
Contributor

Dude @schneems ❤️ .... 👍 👍

@tkbeili
Copy link

tkbeili commented Jan 24, 2013

👍

@ravidsrk
Copy link

Awesome stuff <3

@meiraleal
Copy link

awesome! 😍

@jltxwesley
Copy link

Awesome!!!

@camsong
Copy link
Contributor

camsong commented Jan 25, 2013

Amazing 👍

@wizztjh
Copy link

wizztjh commented Jan 25, 2013

+1

@hujinpu
Copy link

hujinpu commented Jan 25, 2013

Nice feature!

@jankeesvw
Copy link
Contributor

Nice work! 👍

@ahmet
Copy link

ahmet commented Jan 25, 2013

Nice 👍

@jipiboily
Copy link
Contributor

❤️

@josin
Copy link

josin commented Jan 25, 2013

Good job! 👍

@passion8
Copy link
Contributor

very good job,thanks
👍

@peppyheppy
Copy link

👍 I like. (the gif and the PR)

@FUT
Copy link

FUT commented Jan 28, 2013

great!

@ehrktia
Copy link

ehrktia commented Jan 29, 2013

amazed

@djbender
Copy link

👍

@tubbo
Copy link

tubbo commented Jan 29, 2013

love it, but what happens if i want to do rails g resource rails? i wanna be meta!!1 ;-) :shipit:

@ghost
Copy link

ghost commented Jan 30, 2013

tumblr_ma97kgGJmQ1qft9ueo1_500

@rahul100885
Copy link
Contributor

Just awesome

@krishnasrihari
Copy link

Awesome

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

Successfully merging this pull request may close these issues.

None yet