Skip to content

Commit 79ed2eb

Browse files
author
Hasan Gharehasanloo
committed
check params existance before using them
1 parent 11ffb58 commit 79ed2eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ajax-datatables-rails/base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ def records
5454

5555
def fetch_records
5656
records = get_raw_records
57-
records = sort_records(records)
58-
records = filter_records(records)
59-
records = paginate_records(records) unless params[:length] == '-1'
57+
records = sort_records(records) if params[:order].present?
58+
records = filter_records(records) if params[:search].present?
59+
records = paginate_records(records) unless params[:length].present? && params[:length] == '-1'
6060
records
6161
end
6262

0 commit comments

Comments
 (0)