Module: Datagrid::Ordering

Defined in:
lib/datagrid/ordering.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/datagrid/ordering.rb', line 8

def self.included(base)
  base.extend         ClassMethods
  base.class_eval do
    include Datagrid::Columns

    datagrid_attribute :order do |value|
      if value.present?
        value.to_sym
      else
        nil
      end

    end

    datagrid_attribute :descending do |value|
      Datagrid::Utils.booleanize(value)
    end
    alias descending? descending

  end
  base.send :include, InstanceMethods
end