Skip to content

Commit 5abe8a8

Browse files
committed
Simplify the nulls last case statement.
1 parent fe946c8 commit 5abe8a8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ def nulls_last_sql
4343
return unless sort_nulls_last?
4444

4545
case AjaxDatatablesRails.config.db_adapter
46-
when -> (a) { a.in?([:pg, :postgresql, :postgres, :oracle]) }
46+
when :pg, :postgresql, :postgres, :oracle
4747
"NULLS LAST"
48-
when -> (a) { a.in?([:mysql, :mysql2, :sqlite, :sqlite3]) }
48+
when :mysql, :mysql2, :sqlite, :sqlite3
4949
"IS NULL"
5050
else
5151
raise 'unsupported database adapter'

spec/support/test_helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ def data
100100

101101
def nulls_last_sql
102102
case AjaxDatatablesRails.config.db_adapter
103-
when -> (a) { a.in?([:pg, :postgresql, :postgres, :oracle]) }
103+
when :pg, :postgresql, :postgres, :oracle
104104
"NULLS LAST"
105-
when -> (a) { a.in?([:mysql, :mysql2, :sqlite, :sqlite3]) }
105+
when :mysql, :mysql2, :sqlite, :sqlite3
106106
"IS NULL"
107107
else
108108
raise 'unsupported database adapter'

0 commit comments

Comments
 (0)