spec/support/datatable_cond_numeric.rb in ajax-datatables-rails-0.4.1 vs spec/support/datatable_cond_numeric.rb in ajax-datatables-rails-0.4.2
- old
+ new
@@ -37,5 +37,15 @@
class DatatableCondIn < ComplexDatatable
def view_columns
super.deep_merge(post_id: { cond: :in })
end
end
+
+class DatatableCondInWithRegex < DatatableCondIn
+ def view_columns
+ super.deep_merge(post_id: { cond: :in, use_regex: false, orderable: true, formater: ->(str) { cast_regex_value(str) } })
+ end
+
+ def cast_regex_value(value)
+ value.split('|').map(&:to_i)
+ end
+end