Skip to content

Commit cef6ca1

Browse files
author
Nicolas Rodriguez
committed
Merge branch 'SampsonCrowley-v-0-4-0' into v-0-4-0
2 parents 587f0cc + 7e92f7b commit cef6ca1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ def orderable?
1818
end
1919

2020
def orders
21-
return @orders if @orders
22-
@orders = []
23-
options[:order].each do |_, order_options|
24-
@orders << SimpleOrder.new(self, order_options)
25-
end
26-
@orders
21+
@orders ||= options[:order].to_unsafe_h.with_indifferent_access.map { |index, order_options| SimpleOrder.new(self, order_options) }
2722
end
2823

2924
def order_by(how, what)
@@ -43,12 +38,9 @@ def search
4338
# ----------------- COLUMN METHODS --------------------
4439

4540
def columns
46-
return @columns if @columns
47-
@columns = []
48-
options[:columns].each do |index, column_options|
49-
@columns << Column.new(datatable, index, column_options)
41+
@columns ||= options[:columns].to_unsafe_h.with_indifferent_access.map do |index, column_options|
42+
Column.new(datatable, index, column_options)
5043
end
51-
@columns
5244
end
5345

5446
def column_by(how, what)

0 commit comments

Comments
 (0)