Skip to content

Commit fab2908

Browse files
committed
Improve objects shape
1 parent 7faacef commit fab2908

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/ajax-datatables-rails/datatable/column.rb

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ class Column
88
include Order
99
include DateFilter
1010

11-
attr_reader :datatable, :index, :options
11+
attr_reader :datatable, :index, :options, :column_name
1212
attr_writer :search
1313

1414
def initialize(datatable, index, options)
1515
@datatable = datatable
1616
@index = index
1717
@options = options
18-
@view_column = datatable.view_columns[column_name]
18+
@column_name = options[:data]&.to_sym
19+
@view_column = datatable.view_columns[@column_name]
1920

2021
@model = nil
2122
@field = nil
@@ -29,10 +30,6 @@ def initialize(datatable, index, options)
2930
validate_settings!
3031
end
3132

32-
def column_name
33-
@column_name ||= options[:data]&.to_sym
34-
end
35-
3633
def data
3734
options[:data].presence || options[:name]
3835
end

0 commit comments

Comments
 (0)