Sha256: 11fb3dacf41d6d28a647038cea08125b0790c9ca9e7d6608bcd756dc1881a004
Contents?: true
Size: 285 Bytes
Versions: 4
Compression:
Stored size: 285 Bytes
Contents
class HomeController < ApplicationController sort_with :desc do |scope| scope.sort {|a,b| a.v > b.v} end def index @collection = apply_sort(collection) render json: @collection end private def collection @collection ||= [{v: 1}, {v: 2}, {v: 3}] end end
Version data entries
4 entries across 4 versions & 1 rubygems