Skip to content

Instantly share code, notes, and snippets.

@jdibiccari
Created July 1, 2014 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdibiccari/a2a43fa70b9172e5b9ab to your computer and use it in GitHub Desktop.
Save jdibiccari/a2a43fa70b9172e5b9ab to your computer and use it in GitHub Desktop.
blog_post
#First call instance_method on a class to get hold of a method object
#We can then ask the method object where it is defined using source_location
location = Pond.instance_method(:cool_method).source_location
#=> ["/Users/JaneldiBiccari/Development/code/rails_labs/rails-blog-nested-resources-bk-001/app/models/post.rb", 9]
#Now open to that location
`subl #{location[0]}:#{location[1]}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment