{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/18473","labels_url":"https://api.github.com/repos/rails/rails/issues/18473/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/18473/comments","events_url":"https://api.github.com/repos/rails/rails/issues/18473/events","html_url":"https://github.com/rails/rails/issues/18473","id":54120414,"number":18473,"title":"Add Method#source_code","user":{"login":"dhh","id":2741,"avatar_url":"https://avatars.githubusercontent.com/u/2741?v=3","gravatar_id":"","url":"https://api.github.com/users/dhh","html_url":"https://github.com/dhh","followers_url":"https://api.github.com/users/dhh/followers","following_url":"https://api.github.com/users/dhh/following{/other_user}","gists_url":"https://api.github.com/users/dhh/gists{/gist_id}","starred_url":"https://api.github.com/users/dhh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhh/subscriptions","organizations_url":"https://api.github.com/users/dhh/orgs","repos_url":"https://api.github.com/users/dhh/repos","events_url":"https://api.github.com/users/dhh/events{/privacy}","received_events_url":"https://api.github.com/users/dhh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activesupport","name":"activesupport","color":"FC9300"}],"state":"open","locked":false,"assignee":{"login":"guilleiguaran","id":160941,"avatar_url":"https://avatars.githubusercontent.com/u/160941?v=3","gravatar_id":"","url":"https://api.github.com/users/guilleiguaran","html_url":"https://github.com/guilleiguaran","followers_url":"https://api.github.com/users/guilleiguaran/followers","following_url":"https://api.github.com/users/guilleiguaran/following{/other_user}","gists_url":"https://api.github.com/users/guilleiguaran/gists{/gist_id}","starred_url":"https://api.github.com/users/guilleiguaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guilleiguaran/subscriptions","organizations_url":"https://api.github.com/users/guilleiguaran/orgs","repos_url":"https://api.github.com/users/guilleiguaran/repos","events_url":"https://api.github.com/users/guilleiguaran/events{/privacy}","received_events_url":"https://api.github.com/users/guilleiguaran/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rails/rails/milestones/34","labels_url":"https://api.github.com/repos/rails/rails/milestones/34/labels","id":665192,"number":34,"title":"5.0.0","description":null,"creator":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"open_issues":93,"closed_issues":36,"state":"open","created_at":"2014-05-21T00:58:22Z","updated_at":"2015-01-12T23:04:49Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2015-01-12T23:04:49Z","updated_at":"2015-01-13T01:14:13Z","closed_at":null,"body":"Common pattern for me is to inspect the source code of a method I'm curious about like so:\r\n\r\n```ruby\r\nirb(main):018:0> Recording.find(904).children.method(:load).source_location\r\n  Recording Load (0.3ms)  SELECT  `recordings`.* FROM `recordings` WHERE `recordings`.`id` = 904 LIMIT 1\r\n=> [\"/Users/david/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/rails-03e672a3daec/activerecord/lib/active_record/relation.rb\", 513]\r\n```\r\n\r\nThen copy the path to the clipboard, then go to the console and do `mate path`, then APPLE-G to jump to the line.\r\n\r\nLet's make that simpler:\r\n\r\n```ruby\r\nirb(main):018:0> puts Recording.find(904).children.method(:load).source_code\r\n  Recording Load (0.3ms)  SELECT  `recordings`.* FROM `recordings` WHERE `recordings`.`id` = 904 LIMIT 1\r\n\r\n    # Causes the records to be loaded from the database if they have not\r\n    # been loaded already. You can use this if for some reason you need\r\n    # to explicitly load some records before actually using them. The\r\n    # return value is the relation itself, not the records.\r\n    #\r\n    #   Post.where(published: true).load # => #<ActiveRecord::Relation>\r\n    def load\r\n      exec_queries unless loaded?\r\n\r\n      self\r\n    end\r\n```"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/69679030","html_url":"https://github.com/rails/rails/issues/18473#issuecomment-69679030","issue_url":"https://api.github.com/repos/rails/rails/issues/18473","id":69679030,"user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T01:14:13Z","updated_at":"2015-01-13T01:14:13Z","body":"It's by far the most popular debugger. Why include hefty debug methods in every rails app, when a very ubiquitous gem which focuses solely on debugging does the same thing? This feels like Not Invented Here Syndrome to me."}}