Sha256: 0c19086f8fcc8e96b4ec05909340b06eef625c11933f673ccbe589e526e2eab7
Contents?: true
Size: 705 Bytes
Versions: 5
Compression:
Stored size: 705 Bytes
Contents
module ActiveCollection module Order def self.included(mod) mod.extend ClassMethods mod.class_eval do find_scope :order_options end end def order @order ||= self.class.default_order end def order_by(order) ac = dup ac.order_by! order ac end def order_by!(order) raise_if_loaded @order = order end def order_options { :order => order } if order end module ClassMethods def order_by(order = "id ASC") write_inheritable_attribute(:default_order, order) end def default_order read_inheritable_attribute(:default_order) || nil end end end end
Version data entries
5 entries across 5 versions & 2 rubygems