Skip to content

Commit 0f2878c

Browse files
author
Joel Quenneville
committed
Merge pull request jbox-web#4 from JoelQ/generators
added a method to count filtered records
2 parents cea90f1 + 89e7526 commit 0f2878c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

lib/ajax-datatables-rails.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# require 'rails'
22

33
class AjaxDatatablesRails
4+
5+
class MethodError < StandardError; end
46

57
VERSION = '0.0.1'
8+
9+
attr_reader :columns, :model_name, :searchable_columns
610

711
def initialize(view)
812
@view = view
913
end
10-
11-
attr_reader :columns, :model_name, :searchable_columns
1214

1315
def method_missing(meth, *args, &block)
1416
@view.send(meth, *args, &block)
@@ -25,12 +27,16 @@ def as_json(options = {})
2527

2628
private
2729

30+
def data
31+
raise MethodError, "The method `data' is not defined."
32+
end
33+
2834
def get_raw_records
29-
raise
35+
raise MethodError, "The method `get_raw_records' is not defined."
3036
end
3137

3238
def get_raw_record_count
33-
raise
39+
search_records(get_raw_records).count
3440
end
3541

3642
def fetch_records

lib/generators/filterdatatable/filterdatatable.rb

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)