{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6724","repository_url":"https://api.github.com/repos/ManageIQ/manageiq","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6724/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6724/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6724/events","html_url":"https://github.com/ManageIQ/manageiq/pull/6724","id":134118000,"number":6724,"title":"Change EMS total_storages method to use where","user":{"login":"dclarizio","id":3433754,"avatar_url":"https://avatars.githubusercontent.com/u/3433754?v=3","gravatar_id":"","url":"https://api.github.com/users/dclarizio","html_url":"https://github.com/dclarizio","followers_url":"https://api.github.com/users/dclarizio/followers","following_url":"https://api.github.com/users/dclarizio/following{/other_user}","gists_url":"https://api.github.com/users/dclarizio/gists{/gist_id}","starred_url":"https://api.github.com/users/dclarizio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dclarizio/subscriptions","organizations_url":"https://api.github.com/users/dclarizio/orgs","repos_url":"https://api.github.com/users/dclarizio/repos","events_url":"https://api.github.com/users/dclarizio/events{/privacy}","received_events_url":"https://api.github.com/users/dclarizio/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/rails5","name":"rails5","color":"fad8c7"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/ui","name":"ui","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-16T22:47:02Z","updated_at":"2016-02-16T22:56:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6724","html_url":"https://github.com/ManageIQ/manageiq/pull/6724","diff_url":"https://github.com/ManageIQ/manageiq/pull/6724.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/6724.patch"},"body":"After conversion to Rails 5, clicking on Infrastructure / Providers was blowing up in the UI with:\r\n\r\n```\r\n[----] F, [2016-02-16T14:18:41.673243 #29636:310b618] FATAL -- : Error caught: [PG::SyntaxError] ERROR:  syntax error at or near \"{\"\r\nLINE 1: SELECT COUNT({:conditions=>{:host_id=>[360000000000015, 3600...\r\n                     ^\r\n\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/postgresql_adapter.rb:591:in `async_exec'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/postgresql_adapter.rb:591:in `block in exec_no_cache'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract_adapter.rb:528:in `block in log'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activesupport-5.0.0.beta2/lib/active_support/notifications/instrumenter.rb:21:in `instrument'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract_adapter.rb:522:in `log'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/postgresql_adapter.rb:591:in `exec_no_cache'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/postgresql_adapter.rb:578:in `execute_and_clear'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/postgresql/database_statements.rb:103:in `exec_query'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/database_statements.rb:374:in `select'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/database_statements.rb:41:in `select_all'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/relation/calculations.rb:258:in `execute_simple_calculation'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/relation/calculations.rb:217:in `perform_calculation'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/relation/calculations.rb:118:in `calculate'\r\n/home/dclarizio/dev/manageiq/lib/extensions/ar_virtual.rb:315:in `calculate_with_virtual'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/relation/calculations.rb:40:in `count'\r\n/home/dclarizio/.rvm/gems/ruby-2.2.3/gems/activerecord-5.0.0.beta2/lib/active_record/querying.rb:13:in `count'\r\n/home/dclarizio/dev/manageiq/app/models/ext_management_system.rb:434:in `total_storages'\r\n```\r\n\r\nChanged to use where method vs count method with :conditions.\r\n\r\ncc @matthewd @chessbyte "},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/184909463","html_url":"https://github.com/ManageIQ/manageiq/pull/6724#issuecomment-184909463","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6724","id":184909463,"user":{"login":"miq-bot","id":7806257,"avatar_url":"https://avatars.githubusercontent.com/u/7806257?v=3","gravatar_id":"","url":"https://api.github.com/users/miq-bot","html_url":"https://github.com/miq-bot","followers_url":"https://api.github.com/users/miq-bot/followers","following_url":"https://api.github.com/users/miq-bot/following{/other_user}","gists_url":"https://api.github.com/users/miq-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/miq-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miq-bot/subscriptions","organizations_url":"https://api.github.com/users/miq-bot/orgs","repos_url":"https://api.github.com/users/miq-bot/repos","events_url":"https://api.github.com/users/miq-bot/events{/privacy}","received_events_url":"https://api.github.com/users/miq-bot/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T22:56:41Z","updated_at":"2016-02-16T22:56:41Z","body":"<rubocop />Checked commits https://github.com/dclarizio/manageiq/compare/a4bc90a7eaba2059704ab24fec946d420a6ddc31~...cd7b2bb0c1ee4050aa4a23d32494ca32eb698a0a with ruby 2.2.3, rubocop 0.34.2, and haml-lint 0.13.0\n2 files checked, 2 offenses detected\n\n**spec/controllers/ems_infra_controller_spec.rb**\n- [ ] :large_orange_diamond: - [Line 188](https://github.com/dclarizio/manageiq/blob/cd7b2bb0c1ee4050aa4a23d32494ca32eb698a0a/spec/controllers/ems_infra_controller_spec.rb#L188), Col 8 - [Style/BlockDelimiters](http://rubydoc.info/gems/rubocop/0.34.2/RuboCop/Cop/Style/BlockDelimiters) - Avoid using `{...}` for multi-line blocks.\n- [ ] :large_orange_diamond: - [Line 192](https://github.com/dclarizio/manageiq/blob/cd7b2bb0c1ee4050aa4a23d32494ca32eb698a0a/spec/controllers/ems_infra_controller_spec.rb#L192), Col 1 - [Style/EmptyLinesAroundBlockBody](http://rubydoc.info/gems/rubocop/0.34.2/RuboCop/Cop/Style/EmptyLinesAroundBlockBody) - Extra empty line detected at block body end.\n"}}