{"action":"created","issue":{"url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/4","labels_url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/4/comments","events_url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/4/events","html_url":"https://github.com/envygeeks/active_record_mocks/pull/4","id":62549190,"number":4,"title":"Handle pre-existing classes gracefully","user":{"login":"nathanstitt","id":79566,"avatar_url":"https://avatars.githubusercontent.com/u/79566?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanstitt","html_url":"https://github.com/nathanstitt","followers_url":"https://api.github.com/users/nathanstitt/followers","following_url":"https://api.github.com/users/nathanstitt/following{/other_user}","gists_url":"https://api.github.com/users/nathanstitt/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanstitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanstitt/subscriptions","organizations_url":"https://api.github.com/users/nathanstitt/orgs","repos_url":"https://api.github.com/users/nathanstitt/repos","events_url":"https://api.github.com/users/nathanstitt/events{/privacy}","received_events_url":"https://api.github.com/users/nathanstitt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-18T00:28:42Z","updated_at":"2015-03-18T14:29:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/envygeeks/active_record_mocks/pulls/4","html_url":"https://github.com/envygeeks/active_record_mocks/pull/4","diff_url":"https://github.com/envygeeks/active_record_mocks/pull/4.diff","patch_url":"https://github.com/envygeeks/active_record_mocks/pull/4.patch"},"body":"My use case for this is probably fairly unique, but it doesn't hurt to support it.\r\n\r\nI have base class that uses `inherited` to detect when other classes inherit from it.  In the method, I check the class name and perform various actions with it.  \r\n\r\nUnfortunately this breaks when using `active_record_mocks`  The class is created using Class.new, and then assigned to a constant.  Per the Ruby docs (and tests), a class created by using Class.new doesn't have a name. It only gains a name once it's assigned to a constant.  So what ends up happing is that the class is created, it fires the parent class's `inherited` callback (while it has no name), and then is assigned to a constant where it gains a name.\r\n\r\nTo work around this I can create the class myself before hand and then call active_record_mocks' `create_table` to configure it and create the db table.  But then active_record_mocks causes ruby to complain about `constant already exists`"},"comment":{"url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/comments/82996070","html_url":"https://github.com/envygeeks/active_record_mocks/pull/4#issuecomment-82996070","issue_url":"https://api.github.com/repos/envygeeks/active_record_mocks/issues/4","id":82996070,"user":{"login":"nathanstitt","id":79566,"avatar_url":"https://avatars.githubusercontent.com/u/79566?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanstitt","html_url":"https://github.com/nathanstitt","followers_url":"https://api.github.com/users/nathanstitt/followers","following_url":"https://api.github.com/users/nathanstitt/following{/other_user}","gists_url":"https://api.github.com/users/nathanstitt/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanstitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanstitt/subscriptions","organizations_url":"https://api.github.com/users/nathanstitt/orgs","repos_url":"https://api.github.com/users/nathanstitt/repos","events_url":"https://api.github.com/users/nathanstitt/events{/privacy}","received_events_url":"https://api.github.com/users/nathanstitt/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T14:29:47Z","updated_at":"2015-03-18T14:29:47Z","body":"Sorry!  I missed that I wasn't up-to-date.  Just rebased and should be golden now.  Looks to me like Travis timed out on the build, but all specs do complete successfully of me."}}