fix error

This commit is contained in:
邱博亞 2022-03-05 21:41:58 +08:00
parent f072515fa7
commit 957ab330f7
2 changed files with 8 additions and 2 deletions

View File

@ -271,7 +271,9 @@ class Admin::UniversalTablesController < OrbitAdminController
column.each do |c|
columns = (columns | c.column_entries.any_of(:"text.en" => regex).or(:"text.zh_tw" => regex).or(:"content.en" => regex).or(:"content.zh_tw" => regex))
end
columns = Kaminari.paginate_array(columns,limit: columns.count)
columns_count = columns.count
columns_count = 1 if columns_count==0
columns = Kaminari.paginate_array(columns,limit: columns_count)
entries = TableEntry.where(:u_table_id=>table.id).sorting(params: params,table: table,column_entries: columns,page_num: params[:page],per: 10)
end

View File

@ -55,7 +55,11 @@ class TableEntry
if direction == 'desc'
values = values.reverse
end
values = Kaminari.paginate_array(values,limit: values.count)
if paginated || !per.nil?
values_count = values.count
values_count = 1 if values_count==0
values = Kaminari.paginate_array(values,limit: values_count)
end
end
if !per.nil?
values = values.page(page_num).per(per)