Module: DryCrud::Sortable::ClassMethods

Defined in:
app/controllers/dry_crud/sortable.rb

Overview

Class methods for sorting.

Instance Method Summary collapse

Instance Method Details

#sort_mappings=(hash) ⇒ Object

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.



28
29
30
31
# File 'app/controllers/dry_crud/sortable.rb', line 28

def sort_mappings=(hash)
  self.sort_mappings_with_indifferent_access =
    hash.with_indifferent_access
end