{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6224","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6224/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6224/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6224/events","html_url":"https://github.com/ManageIQ/manageiq/pull/6224","id":127271336,"number":6224,"title":"Don't use _type, but let rails derive the _type","user":{"login":"durandom","id":161888,"avatar_url":"https://avatars.githubusercontent.com/u/161888?v=3","gravatar_id":"","url":"https://api.github.com/users/durandom","html_url":"https://github.com/durandom","followers_url":"https://api.github.com/users/durandom/followers","following_url":"https://api.github.com/users/durandom/following{/other_user}","gists_url":"https://api.github.com/users/durandom/gists{/gist_id}","starred_url":"https://api.github.com/users/durandom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/durandom/subscriptions","organizations_url":"https://api.github.com/users/durandom/orgs","repos_url":"https://api.github.com/users/durandom/repos","events_url":"https://api.github.com/users/durandom/events{/privacy}","received_events_url":"https://api.github.com/users/durandom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/core","name":"core","color":"5319e7"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/refactoring","name":"refactoring","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-18T17:09:45Z","updated_at":"2016-01-18T19:03:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6224","html_url":"https://github.com/ManageIQ/manageiq/pull/6224","diff_url":"https://github.com/ManageIQ/manageiq/pull/6224.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/6224.patch"},"body":"Rails is able to figure out what _type and _id to use in a\r\npolymorphic association.\r\nThis is less error-prone on objects with STI\r\n\r\nOne drawback is, that rails does not seem to precompile the query (and presumably use it for later)\r\nI'm not sure where this might be of an impact. @kbrock  ? \r\n```sql\r\n2.2.0 :007 > MiqServer.first.last_log_sync_on # with ':resource_type => obj.class.base_class.name'\r\n  MiqServer Load (0.3ms)  SELECT  \"miq_servers\".* FROM \"miq_servers\"  ORDER BY \"miq_servers\".\"id\" ASC LIMIT 1\r\n  MiqServer Inst Including Associations (20.0ms - 1rows)\r\n  LogFile Load (0.2ms)  SELECT  \"log_files\".\"updated_on\" FROM \"log_files\" WHERE \"log_files\".\"resource_type\" = $1 AND \"log_files\".\"resource_id\" = $2  ORDER BY updated_on DESC LIMIT 1  [[\"resource_type\", \"MiqServer\"], [\"resource_id\", 1]]\r\n  LogFile Inst Including Associations (0.0ms - 0rows)\r\n => nil\r\n2.2.0 :008 > MiqServer.first.last_log_sync_on #  # with ':resource => obj'\r\n  MiqServer Load (0.3ms)  SELECT  \"miq_servers\".* FROM \"miq_servers\"  ORDER BY \"miq_servers\".\"id\" ASC LIMIT 1\r\n  MiqServer Inst Including Associations (22.4ms - 1rows)\r\n  LogFile Load (0.2ms)  SELECT  \"log_files\".\"updated_on\" FROM \"log_files\" WHERE \"log_files\".\"resource_type\" = 'MiqServer' AND \"log_files\".\"resource_id\" = 1  ORDER BY updated_on DESC LIMIT 1\r\n  LogFile Inst Including Associations (0.0ms - 0rows)\r\n```"},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/172624069","html_url":"https://github.com/ManageIQ/manageiq/pull/6224#issuecomment-172624069","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6224","id":172624069,"user":{"login":"kbrock","id":1930,"avatar_url":"https://avatars.githubusercontent.com/u/1930?v=3","gravatar_id":"","url":"https://api.github.com/users/kbrock","html_url":"https://github.com/kbrock","followers_url":"https://api.github.com/users/kbrock/followers","following_url":"https://api.github.com/users/kbrock/following{/other_user}","gists_url":"https://api.github.com/users/kbrock/gists{/gist_id}","starred_url":"https://api.github.com/users/kbrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbrock/subscriptions","organizations_url":"https://api.github.com/users/kbrock/orgs","repos_url":"https://api.github.com/users/kbrock/repos","events_url":"https://api.github.com/users/kbrock/events{/privacy}","received_events_url":"https://api.github.com/users/kbrock/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T19:03:49Z","updated_at":"2016-01-18T19:03:49Z","body":"@durandom I noticed this as well and almost did the same. I was concerned about the `base_class` stuff."}}