- partial_type = (page_view == 'list') ? 'characters/list_section' : 'characters/icon_view'
- skip_grouped_templates = false unless defined?(:skip_grouped_templates)
- if characters.try(:exists?)
  - template_ids = characters.group(:template_id).pluck(:template_id).uniq.compact
  - templates = ActiveRecord::Base::Template.where(id: template_ids).order('name asc').each do |template|
    - next if skip_grouped_templates && template.characters.where('character_group_id is not null').exists?
    = render partial: partial_type, locals: {name: template, characters: template.characters.order('name asc')}
  - if characters.where(template_id: nil).exists?
    = render partial: partial_type, locals: {name: 'No Template', characters: characters.where(template_id: nil).order('name asc'), show_new_character_button: @user.id == current_user&.id}
- else
  %tr
    %td.centered.padding-5{class: cycle('even', 'odd'), colspan: 6} — No characters yet —

- partial_type = (page_view == 'list') ? 'characters/list_section' : 'characters/icon_view'
- skip_grouped_templates = false unless defined?(:skip_grouped_templates)
- if characters.try(:exists?)
  - template_ids = characters.group(:template_id).pluck(:template_id).uniq.compact
  - templates = ::Template.where(id: template_ids).order('name asc').each do |template|
    - next if skip_grouped_templates && template.characters.where('character_group_id is not null').exists?
    = render partial: partial_type, locals: {name: template, characters: template.characters.order('name asc')}
  - if characters.where(template_id: nil).exists?
    = render partial: partial_type, locals: {name: 'No Template', characters: characters.where(template_id: nil).order('name asc'), show_new_character_button: @user.id == current_user&.id}
- else
  %tr
    %td.centered.padding-5{class: cycle('even', 'odd'), colspan: 6} — No characters yet —

Fix character lists with character groups
Fix character lists with character groups

After the upgrade to Ruby 2.5, which removed top-level constant lookup,
we now have an error where we try to specify explicitly the path to the
Template class (to prevent a conflict with `ActionView::Template`). Fix
this by looking for the model as a top-level constant.
