I think we can generalize this to:

```ruby
all_config_templates = (nested_obj.present? ? nested_obj.config_templates : ConfigTemplate)
@config_templates = all_config_templates.
                                          authorized(:view_templates).
                                          includes(:operatingsystems, :template_combinations, :template_kind).
                                          search_for(*search_options).paginate(paginate_options)
@total = all_config_templates.authorized(:view_architectures).count
```

and avoid the if clause.