Sha256: 8c8249642bafd4a1c3d3e6bfdc4cffd57fda7a860227dd91b13173b50393936f
Contents?: true
Size: 566 Bytes
Versions: 21
Compression:
Stored size: 566 Bytes
Contents
class Dorsale::Alexandrie::AttachmentsSorter < Agilibox::Sorter def sort case column when :created_at, :updated_at {column => direction} when :name Arel.sql %(LOWER(#{model.table_name}.#{column}) #{direction}) when :attachment_type_name @collection = @collection.joins(:attachment_type) table = Dorsale::Alexandrie::AttachmentType.table_name Arel.sql %(LOWER(#{table}.name) #{direction}) else {created_at: :desc, id: :desc} end end private def model Dorsale::Alexandrie::Attachment end end
Version data entries
21 entries across 21 versions & 1 rubygems