lib/roaster/decorator.rb
#TODO: Disallow sorting directly by relationship (need relationship field)
Disallow sorting directly by relationship (need relationship field)
Disallow sorting directly by relationship ( need relationship field )
def can_sort_by(*attrs)
        representable_attrs[:_sortable_attributes] ||= []
        sort_keys = attrs.map do |option|
          if option.class == Hash
            { option.first[0].to_sym => option.first[1].map(&:to_sym) }
          else
            option.to_sym
          end
        end
        representable_attrs[:_sortable_attributes].push(*sort_keys).uniq!
      end
def can_sort_by ( * attrs ) representable_attrs [ :_sortable_attributes ] ||= [ ] sort_keys = attrs . map do | option | if option . class == Hash { option . first [ 0 ] . to_sym => option . first [ 1 ] . map ( & :to_sym ) } else option . to_sym end end representable_attrs [ :_sortable_attributes ] . push ( * sort_keys ) . uniq! end
TODO: Disallow sorting directly by relationship (need relationship field)
TODO : Disallow sorting directly by relationship ( need relationship field )
attrs
<not_specific>