I think the `@hostgrpup` assignment in the condition is worse. It's a side-effect hidden assignment in condition vs function. For me function wins. More so I've just tested and it works for nil:
```ruby
@hostgroup = ::Hostgroup.find_by_id(params[:hostgroup_id] ||
    @deployment.child_hostgroups.deploy_order.first 
```