I just notices that is already mentioned in https://github.com/theforeman/foreman/pull/1068#discussion_r12085491. The issue discussed here regarding all_config_templates containing all the config templates in Array is based on false assumption. `all_config_templates` or in my example called `config_templates_scope` will contain scope not Array and will not trigger SQL queries. I am assuming `nested_obj.config_templates` is calling regular association.