extjs_renderer 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module ExtjsRenderer
15
15
  end
16
16
 
17
17
  # set root to passed or resource
18
- root = options && options.has_key?(:root) ? options[:root] : resource.last.class.name.downcase
18
+ root = options && options.has_key?(:root) ? options[:root] : resource.klass.to_s.downcase
19
19
 
20
20
  json = '{"total":'+total.to_s+',"'+root+'":'+resource.to_json(options)+'}'
21
21
 
@@ -1,3 +1,3 @@
1
1
  module ExtjsRenderer
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -17,6 +17,14 @@ describe OrdersController do
17
17
  json['total'].should eq(1)
18
18
  json['order'].should_not be_nil
19
19
  end
20
+
21
+ it "responds with correct root with no records" do
22
+ xhr :get, :index, :format => :json
23
+ json = ActiveSupport::JSON.decode(response.body)
24
+ json['total'].should eq(0)
25
+ json['order'].should_not be_nil
26
+ end
27
+
20
28
  end
21
29
 
22
30
  describe "GET 'change_root'" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: extjs_renderer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mark H Winkler
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-22 00:00:00 Z
13
+ date: 2011-12-27 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails