Skip to content

Commit 03a7379

Browse files
author
M. Saiqul Haq
committed
sortable_column should have custom model name too
1 parent 173d687 commit 03a7379

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/ajax-datatables-rails/base.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ def per_page
154154
end
155155

156156
def sort_column(item)
157-
sortable_columns[item[:column].to_i]
157+
sortable_column = sortable_columns[item[:column].to_i].split(".")
158+
model, column = sortable_column
159+
unless models[model].nil?
160+
sortable_column = [models[model].table_name.to_s, column].join(".")
161+
end
162+
sortable_column
158163
end
159164

160165
def sort_direction(item)

0 commit comments

Comments
 (0)