{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3190","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3190/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3190/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3190/events","html_url":"https://github.com/ManageIQ/manageiq/issues/3190","id":88846305,"number":3190,"title":"ERROR: column miq_regions.miq_enterprise_id does not exist LINE 1: SELECT \"miq_regions\".* FROM \"miq_regions\" WHERE \"miq_regions... ^ [miq_capacity/utilization] ","user":{"login":"GregP","id":552686,"avatar_url":"https://avatars.githubusercontent.com/u/552686?v=3","gravatar_id":"","url":"https://api.github.com/users/GregP","html_url":"https://github.com/GregP","followers_url":"https://api.github.com/users/GregP/followers","following_url":"https://api.github.com/users/GregP/following{/other_user}","gists_url":"https://api.github.com/users/GregP/gists{/gist_id}","starred_url":"https://api.github.com/users/GregP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregP/subscriptions","organizations_url":"https://api.github.com/users/GregP/orgs","repos_url":"https://api.github.com/users/GregP/repos","events_url":"https://api.github.com/users/GregP/events{/privacy}","received_events_url":"https://api.github.com/users/GregP/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/rails%204","name":"rails 4","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"GregP","id":552686,"avatar_url":"https://avatars.githubusercontent.com/u/552686?v=3","gravatar_id":"","url":"https://api.github.com/users/GregP","html_url":"https://github.com/GregP","followers_url":"https://api.github.com/users/GregP/followers","following_url":"https://api.github.com/users/GregP/following{/other_user}","gists_url":"https://api.github.com/users/GregP/gists{/gist_id}","starred_url":"https://api.github.com/users/GregP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregP/subscriptions","organizations_url":"https://api.github.com/users/GregP/orgs","repos_url":"https://api.github.com/users/GregP/repos","events_url":"https://api.github.com/users/GregP/events{/privacy}","received_events_url":"https://api.github.com/users/GregP/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-06-16T21:35:15Z","updated_at":"2015-06-19T20:11:05Z","closed_at":null,"body":"To reproduce, click on Optimize (tab) in UI \r\n\r\nLog shows:\r\n\r\n[----] E, [2015-06-16T14:28:18.146250 #44739:3fecde05e6e0] ERROR -- : PG::Error: ERROR:  column miq_regions.miq_enterprise_id does not exist\r\nLINE 1: SELECT \"miq_regions\".* FROM \"miq_regions\" WHERE \"miq_regions...\r\n                                                        ^\r\n: SELECT \"miq_regions\".* FROM \"miq_regions\" WHERE \"miq_regions\".\"miq_enterprise_id\" = $1\r\n[----] F, [2015-06-16T14:28:18.146804 #44739:3fecde05e6e0] FATAL -- : Error caught: [PG::Error] ERROR:  column miq_regions.miq_enterprise_id does not exist\r\nLINE 1: SELECT \"miq_regions\".* FROM \"miq_regions\" WHERE \"miq_regions...\r\n                                                        ^\r\n"},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/113629391","html_url":"https://github.com/ManageIQ/manageiq/issues/3190#issuecomment-113629391","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3190","id":113629391,"user":{"login":"Fryguy","id":52120,"avatar_url":"https://avatars.githubusercontent.com/u/52120?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryguy","html_url":"https://github.com/Fryguy","followers_url":"https://api.github.com/users/Fryguy/followers","following_url":"https://api.github.com/users/Fryguy/following{/other_user}","gists_url":"https://api.github.com/users/Fryguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryguy/subscriptions","organizations_url":"https://api.github.com/users/Fryguy/orgs","repos_url":"https://api.github.com/users/Fryguy/repos","events_url":"https://api.github.com/users/Fryguy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryguy/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T20:11:05Z","updated_at":"2015-06-19T20:11:05Z","body":"@tenderlove Working with @GregP and we noticed that you changed the code [here](https://github.com/ManageIQ/manageiq/commit/bc865e6d3ac430dbf4e9c620861f5cee1ecae8b7#diff-b08386595ac7d4b08da2b0389593c9eeL2), but that code doesn't work at all.  The lambda is sort of ignored (or actually something tries to call `.except` on it if you change it to something else like a SQL String), and otherwise it goes back to the database looking for an `miq_enterprise_id`.  I know in email you suggested to use a simple instance method (`def miq_regions; MiqRegion.all; end `) with a virtual column, which is probably better anyway, but I'm trying to understand the \"right\" way to do finder_sql in rails 4 if we need it for other purposes.\r\n\r\ncc @matthewd \r\n"}}