{"action":"created","issue":{"url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/86","labels_url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/86/comments","events_url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/86/events","html_url":"https://github.com/segmentio/analytics-ruby/issues/86","id":108266373,"number":86,"title":"Doesn't work inside rails runner or rake task?","user":{"login":"dseravalli","id":1758219,"avatar_url":"https://avatars.githubusercontent.com/u/1758219?v=3","gravatar_id":"","url":"https://api.github.com/users/dseravalli","html_url":"https://github.com/dseravalli","followers_url":"https://api.github.com/users/dseravalli/followers","following_url":"https://api.github.com/users/dseravalli/following{/other_user}","gists_url":"https://api.github.com/users/dseravalli/gists{/gist_id}","starred_url":"https://api.github.com/users/dseravalli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dseravalli/subscriptions","organizations_url":"https://api.github.com/users/dseravalli/orgs","repos_url":"https://api.github.com/users/dseravalli/repos","events_url":"https://api.github.com/users/dseravalli/events{/privacy}","received_events_url":"https://api.github.com/users/dseravalli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-25T05:31:46Z","updated_at":"2016-01-27T20:05:38Z","closed_at":null,"body":"I have a simple import script I'm trying to run with `rails runner -e local /path/to/script.rb` that seems to work but nothing shows up in the Segment debugger. My identify calls return true and error handler is not hit. The same code works if I `load` the file in the rails console."},"comment":{"url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/comments/175828030","html_url":"https://github.com/segmentio/analytics-ruby/issues/86#issuecomment-175828030","issue_url":"https://api.github.com/repos/segmentio/analytics-ruby/issues/86","id":175828030,"user":{"login":"michaeljkchoi","id":1698990,"avatar_url":"https://avatars.githubusercontent.com/u/1698990?v=3","gravatar_id":"","url":"https://api.github.com/users/michaeljkchoi","html_url":"https://github.com/michaeljkchoi","followers_url":"https://api.github.com/users/michaeljkchoi/followers","following_url":"https://api.github.com/users/michaeljkchoi/following{/other_user}","gists_url":"https://api.github.com/users/michaeljkchoi/gists{/gist_id}","starred_url":"https://api.github.com/users/michaeljkchoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaeljkchoi/subscriptions","organizations_url":"https://api.github.com/users/michaeljkchoi/orgs","repos_url":"https://api.github.com/users/michaeljkchoi/repos","events_url":"https://api.github.com/users/michaeljkchoi/events{/privacy}","received_events_url":"https://api.github.com/users/michaeljkchoi/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T20:05:38Z","updated_at":"2016-01-27T20:05:38Z","body":"I'm not sure if this is the same issue or not, but it doesn't seem to work for ActiveJob either.\r\n```\r\n# app/jobs/foo.rb\r\nclass Foo < ActiveJob::Base\r\n  queue_as :high_priority\r\n\r\n  def perform\r\n    AnalyticsService.new.track(user_id: \"foobar\", event: \"Foo Bar\") # service that calls Segment\r\n  end\r\nend\r\n```\r\n\r\nIt seems if we run the Job directly `Foo.new.perform` it works as expected.  But if we delay the job with `Foo.perform_later`, then it no longer works."}}