data_table 0.1.9 → 0.2.0

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
- data_table (0.1.7)
4
+ data_table (0.2.0)
5
5
  rails (~> 3.0.0)
6
6
  will_paginate (~> 3.0.pre2)
7
7
 
@@ -9,63 +9,63 @@ GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
11
  abstract (1.0.0)
12
- actionmailer (3.0.0)
13
- actionpack (= 3.0.0)
14
- mail (~> 2.2.5)
15
- actionpack (3.0.0)
16
- activemodel (= 3.0.0)
17
- activesupport (= 3.0.0)
12
+ actionmailer (3.0.5)
13
+ actionpack (= 3.0.5)
14
+ mail (~> 2.2.15)
15
+ actionpack (3.0.5)
16
+ activemodel (= 3.0.5)
17
+ activesupport (= 3.0.5)
18
18
  builder (~> 2.1.2)
19
19
  erubis (~> 2.6.6)
20
- i18n (~> 0.4.1)
20
+ i18n (~> 0.4)
21
21
  rack (~> 1.2.1)
22
- rack-mount (~> 0.6.12)
23
- rack-test (~> 0.5.4)
22
+ rack-mount (~> 0.6.13)
23
+ rack-test (~> 0.5.7)
24
24
  tzinfo (~> 0.3.23)
25
- activemodel (3.0.0)
26
- activesupport (= 3.0.0)
25
+ activemodel (3.0.5)
26
+ activesupport (= 3.0.5)
27
27
  builder (~> 2.1.2)
28
- i18n (~> 0.4.1)
29
- activerecord (3.0.0)
30
- activemodel (= 3.0.0)
31
- activesupport (= 3.0.0)
32
- arel (~> 1.0.0)
28
+ i18n (~> 0.4)
29
+ activerecord (3.0.5)
30
+ activemodel (= 3.0.5)
31
+ activesupport (= 3.0.5)
32
+ arel (~> 2.0.2)
33
33
  tzinfo (~> 0.3.23)
34
- activeresource (3.0.0)
35
- activemodel (= 3.0.0)
36
- activesupport (= 3.0.0)
37
- activesupport (3.0.0)
38
- arel (1.0.1)
39
- activesupport (~> 3.0.0)
34
+ activeresource (3.0.5)
35
+ activemodel (= 3.0.5)
36
+ activesupport (= 3.0.5)
37
+ activesupport (3.0.5)
38
+ arel (2.0.9)
40
39
  builder (2.1.2)
41
40
  diff-lcs (1.1.2)
42
41
  erubis (2.6.6)
43
42
  abstract (>= 1.0.0)
44
- i18n (0.4.1)
45
- mail (2.2.6.1)
43
+ i18n (0.5.0)
44
+ mail (2.2.17)
46
45
  activesupport (>= 2.3.6)
47
- mime-types
48
- treetop (>= 1.4.5)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
49
  mime-types (1.16)
50
50
  polyglot (0.3.1)
51
- rack (1.2.1)
51
+ rack (1.2.2)
52
52
  rack-mount (0.6.13)
53
53
  rack (>= 1.0.0)
54
- rack-test (0.5.6)
54
+ rack-test (0.5.7)
55
55
  rack (>= 1.0)
56
- rails (3.0.0)
57
- actionmailer (= 3.0.0)
58
- actionpack (= 3.0.0)
59
- activerecord (= 3.0.0)
60
- activeresource (= 3.0.0)
61
- activesupport (= 3.0.0)
62
- bundler (~> 1.0.0)
63
- railties (= 3.0.0)
64
- railties (3.0.0)
65
- actionpack (= 3.0.0)
66
- activesupport (= 3.0.0)
67
- rake (>= 0.8.4)
68
- thor (~> 0.14.0)
56
+ rails (3.0.5)
57
+ actionmailer (= 3.0.5)
58
+ actionpack (= 3.0.5)
59
+ activerecord (= 3.0.5)
60
+ activeresource (= 3.0.5)
61
+ activesupport (= 3.0.5)
62
+ bundler (~> 1.0)
63
+ railties (= 3.0.5)
64
+ railties (3.0.5)
65
+ actionpack (= 3.0.5)
66
+ activesupport (= 3.0.5)
67
+ rake (>= 0.8.7)
68
+ thor (~> 0.14.4)
69
69
  rake (0.8.7)
70
70
  rr (1.0.0)
71
71
  rspec (2.0.1)
@@ -79,10 +79,10 @@ GEM
79
79
  rspec-core (~> 2.0.1)
80
80
  rspec-expectations (~> 2.0.1)
81
81
  shoulda (2.11.3)
82
- thor (0.14.1)
83
- treetop (1.4.8)
82
+ thor (0.14.6)
83
+ treetop (1.4.9)
84
84
  polyglot (>= 0.3.1)
85
- tzinfo (0.3.23)
85
+ tzinfo (0.3.26)
86
86
  will_paginate (3.0.pre2)
87
87
 
88
88
  PLATFORMS
@@ -90,8 +90,6 @@ PLATFORMS
90
90
 
91
91
  DEPENDENCIES
92
92
  data_table!
93
- rails (~> 3.0.0)
94
93
  rr (~> 1.0.0)
95
94
  rspec (~> 2.0.0)
96
95
  shoulda (~> 2.11.0)
97
- will_paginate (~> 3.0.pre2)
@@ -11,15 +11,21 @@ module DataTable
11
11
 
12
12
  def _discover_joins fields
13
13
  joins = Set.new
14
+ object = self.new
14
15
 
15
16
  fields.each { |it|
16
17
  field = it.split('.')
18
+
17
19
  if (field.size == 2) then
18
- joins.add field[0].singularize.to_sym
20
+ if object.respond_to?(field[0].to_sym)
21
+ joins.add field[0].to_sym
22
+ elsif object.respond_to?(field[0].singularize.to_sym)
23
+ joins.add field[0].singularize.to_sym
24
+ end
19
25
  end
20
26
  }
21
27
 
22
- joins.collect
28
+ joins.to_a
23
29
  end
24
30
 
25
31
  def _where_conditions query, search_fields
@@ -1,3 +1,3 @@
1
1
  module DataTable
2
- VERSION = "0.1.9"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -36,9 +36,18 @@ describe DataTable do
36
36
 
37
37
  context "#_discover_joins" do
38
38
 
39
- it "should return the joins on the fields" do
40
- _discover_joins(%w(foo.bar foz.ber baz)).should == [:foo, :foz]
41
- end
39
+ it "should return the joins on the fields" do
40
+ mock(self).new {self}
41
+ stub(self).foo {true}
42
+ stub(self).foz {true}
43
+ stub(self).furs {true}
44
+
45
+ joins = _discover_joins(%w(foo.bar foz.ber furs.bib nones.zip baz))
46
+ joins.should include :foo
47
+ joins.should include :foz
48
+ joins.should include :furs
49
+ joins.should_not include :nones
50
+ end
42
51
 
43
52
  end
44
53
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 9
10
- version: 0.1.9
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Dew
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-25 00:00:00 -04:00
18
+ date: 2011-06-02 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements: []
159
159
 
160
160
  rubyforge_project: data_table
161
- rubygems_version: 1.4.2
161
+ rubygems_version: 1.4.1
162
162
  signing_key:
163
163
  specification_version: 3
164
164
  summary: Simple data preparation from AR/Mongoid to the jQuery DataTables plugin