rabl 0.6.6 → 0.6.7
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/CHANGELOG.md +5 -0
- data/fixtures/rails3/script/rails +1 -1
- data/fixtures/rails3_2/test/functional/posts_controller_test.rb +4 -0
- data/lib/rabl/builder.rb +2 -1
- data/lib/rabl/engine.rb +1 -0
- data/lib/rabl/version.rb +1 -1
- data/test/integration/rails3_2/posts_controller_test.rb +4 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.6.7
|
4
|
+
|
5
|
+
* Fix format to default to json in the event that it is a 'hash' (Thanks @databyte)
|
6
|
+
* Support using cache keys within extended templates (Thanks @databyte)
|
7
|
+
|
3
8
|
## 0.6.6
|
4
9
|
|
5
10
|
* Even more improvements to Rails template resolution (Thanks @databyte)
|
@@ -144,6 +144,10 @@ context "PostsController" do
|
|
144
144
|
end.equals { @posts.map(&:title) }
|
145
145
|
|
146
146
|
asserts(:body).equals { cache_hit ['kittens!', @posts, nil, 'json'] }
|
147
|
+
|
148
|
+
asserts("contains cache hits per object (posts by title)") do
|
149
|
+
json_output['articles'].map { |o| o['article']['title'] }
|
150
|
+
end.equals { @posts.map{ |p| cache_hit([p, nil, 'hash'])[:title] } }
|
147
151
|
end # index action, caching, json
|
148
152
|
|
149
153
|
context "for index action with caching in xml" do
|
data/lib/rabl/builder.rb
CHANGED
@@ -127,7 +127,8 @@ module Rabl
|
|
127
127
|
# Returns a guess at the format in this scope
|
128
128
|
# request_format => "xml"
|
129
129
|
def request_format
|
130
|
-
|
130
|
+
format = @options[:format]
|
131
|
+
format && format != "hash" ? format : 'json'
|
131
132
|
end
|
132
133
|
|
133
134
|
# Caches the results of the block based on object cache_key
|
data/lib/rabl/engine.rb
CHANGED
data/lib/rabl/version.rb
CHANGED
@@ -144,6 +144,10 @@ context "PostsController" do
|
|
144
144
|
end.equals { @posts.map(&:title) }
|
145
145
|
|
146
146
|
asserts(:body).equals { cache_hit ['kittens!', @posts, nil, 'json'] }
|
147
|
+
|
148
|
+
asserts("contains cache hits per object (posts by title)") do
|
149
|
+
json_output['articles'].map { |o| o['article']['title'] }
|
150
|
+
end.equals { @posts.map{ |p| cache_hit([p, nil, 'hash'])[:title] } }
|
147
151
|
end # index action, caching, json
|
148
152
|
|
149
153
|
context "for index action with caching in xml" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nathan Esquenazi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-04-04 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|