This could be DRY-ed:
```ruby
config_templates_scope = nested_obj ? nested_obj.config_templates : ConfigTemplate.scoped
@config_templates      = config_templates_scope.
    authorized(:view_templates).
    includes(:operatingsystems, :template_combinations, :template_kind).
    search_for(*search_options).
    paginate(paginate_options)
@total                 = config_templates_scope.authorized(:view_templates).count
```