lib/active_scaffold/finder.rb
# TODO: this should reside on the column, not the controller
this should reside on the column, not the controller
this should reside on the column not the controller
def sort_collection_by_column(collection, column, order)
      sorter = column.sort[:method]
      collection = collection.sort_by do |record|
        value = sorter.is_a?(Proc) ? record.instance_eval(&sorter) : record.instance_eval(sorter.to_s)
        value = '' if value.nil?
        value
      end
      collection.reverse! if order.casecmp('DESC').zero?
      collection
    end
def sort_collection_by_column ( collection , column , order ) sorter = column . sort [ :method ] collection = collection . sort_by do | record | value = sorter . is_a? ( Proc ) ? record . instance_eval ( & sorter ) : record . instance_eval ( sorter . to_s ) value = '' if value . nil? value end collection . reverse! if order . casecmp ( 'DESC' ) . zero? collection end
TODO: this should reside on the column, not the controller
TODO : this should reside on the column not the controller
collection
<not_specific>
column
<not_specific>
order
<not_specific>