mongoid_data_table 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_data_table (0.1.0)
4
+ mongoid_data_table (0.1.1)
5
5
  actionpack (~> 3.0.0)
6
6
  activesupport (~> 3.0.0)
7
7
  mongoid (~> 2.0.0.beta18)
@@ -7,7 +7,7 @@ module Mongoid
7
7
  end
8
8
 
9
9
  module ClassMethods
10
- def json_for_datatables controller, fields, search_fields=nil, &block
10
+ def for_data_table controller, fields, search_fields=nil, &block
11
11
  params = controller.params
12
12
  search_fields ||= fields
13
13
  objects = self.where(_where_conditions params[:sSearch], search_fields).
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module DataTable
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@ describe Mongoid::DataTable do
11
11
  it "should extend ActionView::Helpers::JavaScriptHelper"
12
12
  end
13
13
 
14
- context "#json_for_datatables" do
14
+ context "#for_data_table" do
15
15
 
16
16
  it "should produce JSON for the datatables plugin to consume" do
17
17
  params = {:sSearch => "answer", :iSortCol_0 => "0", :sSortDir_0 => "desc", :iDisplayLength => 10, :sEcho => 1}
@@ -27,7 +27,7 @@ describe Mongoid::DataTable do
27
27
  mock(self).where("where clause") { mock!.order_by("order by") { mock!.paginate({:page => "page", :per_page => 10}) { objects } } }
28
28
  mock(self).count { 42 }
29
29
 
30
- result = json_for_datatables(controller, %w(foo bar baz), %w(foo bar)) {|x| [x] }
30
+ result = for_data_table(controller, %w(foo bar baz), %w(foo bar)) {|x| [x] }
31
31
  result.should == {:sEcho => 1, :iTotalRecords => 42, :iTotalDisplayRecords => 10, :aaData => %([["x"], ["x"]])}.to_json.html_safe
32
32
  end
33
33
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_data_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Dew