Module: Mongoid::DataTable::ClassMethods

Defined in:
lib/mongoid/data_table.rb

Instance Method Summary collapse

Instance Method Details

#data_table_datasetObject



36
37
38
# File 'lib/mongoid/data_table.rb', line 36

def data_table_dataset
  self.data_table_options[:dataset]
end

#data_table_fieldsObject



24
25
26
# File 'lib/mongoid/data_table.rb', line 24

def data_table_fields
  self.data_table_options[:fields] ||= self.fields.dup.stringify_keys.keys.reject { |k| Mongoid.destructive_fields.include?(k) }
end

#data_table_searchable_fieldsObject



28
29
30
# File 'lib/mongoid/data_table.rb', line 28

def data_table_searchable_fields
  self.data_table_options[:searchable] ||= self.data_table_fields
end

#data_table_sortable_fieldsObject



32
33
34
# File 'lib/mongoid/data_table.rb', line 32

def data_table_sortable_fields
  self.data_table_options[:sortable] ||= self.data_table_fields
end

#to_data_table(controller, options = {}, &block) ⇒ Object



40
41
42
# File 'lib/mongoid/data_table.rb', line 40

def to_data_table(controller, options = {}, &block)
  ::Mongoid::DataTable::Proxy.new(self, controller, options, &block)
end