Sort functionality for the index table. Extracted into an own module for convenience.
Adds a :sort_mappings class attribute.
# File lib/generators/dry_crud/templates/app/controllers/list_controller.rb, line 185 def self.included(controller) # Define a map of (virtual) attributes to SQL order expressions. # May be used for sorting table columns that do not appear directly # in the database table. E.g., map :city_id => 'cities.name' to # sort the displayed city names. controller.class_attribute :sort_mappings controller.sort_mappings = {} controller.helper_method :sortable? controller.alias_method_chain :list_entries, :sort end