Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (19 sloc) 600 Bytes
module Extensions
# ActiveRecord extensions
module ActiveRecord
# Extensions for ActiveRecord::Relation
module Relation
extend ActiveSupport::Concern
# Introduce a new AR Relation method :-)
def sorty_sort(column = nil, direction = nil)
::SortySorter::Sort.apply(self, column, direction)
end
def sorty_sort!(column = nil, direction = nil)
::SortySorter::Sort.apply!(self, column, direction)
end
end
end
end
ActiveSupport.on_load(:active_record) do
ActiveRecord::Relation.send(:include, Extensions::ActiveRecord::Relation)
end