Module: Datagrid::ColumnNamesAttribute

Extended by:
ActiveSupport::Concern
Defined in:
lib/datagrid/column_names_attribute.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#columns(*args) ⇒ Object

:nodoc:


38
39
40
41
42
43
# File 'lib/datagrid/column_names_attribute.rb', line 38

def columns(*args) #:nodoc:
  options = args.extract_options!
  column_names = selected_column_names(*args)
  column_names << options
  super(*column_names)
end

#mandatory_columnsObject

Returns a list of enabled columns with :mandatory => true option If no mandatory columns specified than all of them considered mandatory


47
48
49
# File 'lib/datagrid/column_names_attribute.rb', line 47

def mandatory_columns
  available_columns.select {|c| c.mandatory? }
end

#optional_columnsObject

Returns a list of enabled columns without :mandatory => true option


52
53
54
# File 'lib/datagrid/column_names_attribute.rb', line 52

def optional_columns
  available_columns - mandatory_columns
end