{"action":"created","issue":{"url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/341","labels_url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/341/comments","events_url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/341/events","html_url":"https://github.com/rollbar/rollbar-gem/pull/341","id":117353570,"number":341,"title":"Allow access to controller variables from custom_data_method","user":{"login":"guanglunw","id":1167950,"avatar_url":"https://avatars.githubusercontent.com/u/1167950?v=3","gravatar_id":"","url":"https://api.github.com/users/guanglunw","html_url":"https://github.com/guanglunw","followers_url":"https://api.github.com/users/guanglunw/followers","following_url":"https://api.github.com/users/guanglunw/following{/other_user}","gists_url":"https://api.github.com/users/guanglunw/gists{/gist_id}","starred_url":"https://api.github.com/users/guanglunw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guanglunw/subscriptions","organizations_url":"https://api.github.com/users/guanglunw/orgs","repos_url":"https://api.github.com/users/guanglunw/repos","events_url":"https://api.github.com/users/guanglunw/events{/privacy}","received_events_url":"https://api.github.com/users/guanglunw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-17T13:22:53Z","updated_at":"2015-11-17T15:45:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rollbar/rollbar-gem/pulls/341","html_url":"https://github.com/rollbar/rollbar-gem/pull/341","diff_url":"https://github.com/rollbar/rollbar-gem/pull/341.diff","patch_url":"https://github.com/rollbar/rollbar-gem/pull/341.patch"},"body":"Related to #237 \r\n\r\nWhen logging custom data, we'd like access to controller instance variables. This change lets the lambda be evaluated in the context of the controller, which gives access to its variables and methods.\r\n\r\nAdditionally, it's often useful to specify custom data at the controller level, rather than via a global initialiser. So there's support for this via the following proposed syntax:\r\n\r\n```ruby\r\ninclude Rollbar::Rails\r\non_exception_log_values :@instance_var, :any_method\r\n```"},"comment":{"url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/comments/157409088","html_url":"https://github.com/rollbar/rollbar-gem/pull/341#issuecomment-157409088","issue_url":"https://api.github.com/repos/rollbar/rollbar-gem/issues/341","id":157409088,"user":{"login":"jondeandres","id":122581,"avatar_url":"https://avatars.githubusercontent.com/u/122581?v=3","gravatar_id":"","url":"https://api.github.com/users/jondeandres","html_url":"https://github.com/jondeandres","followers_url":"https://api.github.com/users/jondeandres/followers","following_url":"https://api.github.com/users/jondeandres/following{/other_user}","gists_url":"https://api.github.com/users/jondeandres/gists{/gist_id}","starred_url":"https://api.github.com/users/jondeandres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jondeandres/subscriptions","organizations_url":"https://api.github.com/users/jondeandres/orgs","repos_url":"https://api.github.com/users/jondeandres/repos","events_url":"https://api.github.com/users/jondeandres/events{/privacy}","received_events_url":"https://api.github.com/users/jondeandres/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T15:45:14Z","updated_at":"2015-11-17T15:45:14Z","body":"Hi @guanglunw,\r\n\r\nthanks for the PR. This is a very requested feature, so yes, thanks again for working on it!\r\n\r\nI've liked the idea of having a class method on controllers in order to store which attribute or methods add to the extra data. However I think the code can be simpler if we store that data in the controller itself instead of the configuration, so the code in `RequestDataExtractor` can just ask the controller for the data.\r\n\r\nProbably we'll want to take fork this branch, play with it and maybe do some checks since there are quite important changes here.\r\n\r\nBeside this, probably more tests on `specs/controllers` would be nice.\r\n\r\nI will also do some comments in the code."}}