This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hack to load json gem first so we can overwrite its to_json. | |
begin | |
require 'json' | |
rescue LoadError | |
end |