Skip to content

Instantly share code, notes, and snippets.

module Sortable
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.send(:class_inheritable_accessor, :sort_attributes)
base.sort_attributes = []
end
module ClassMethods
# Hack to load json gem first so we can overwrite its to_json.
begin
require 'json'
rescue LoadError
end