theforeman/foreman — pull request #1415 by GregSutcliffe (2014-04-30 12:01:52+00:00)
Title: Fixes 4287: Correctly skip template associations when looking for matches

Separate `if` clauses was causing the system to look for incorrect matches (i.e a template which has both an environment and hostgroup association for hostgroup only)