Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates changelog and prepare for 0.7.0 release

  • Loading branch information...
commit 152d141fc4527ed85d1f23fe2c43ecaf9fc2b5e2 1 parent 224ecf5
@nesquena authored
View
9 CHANGELOG.md
@@ -1,6 +1,13 @@
# CHANGELOG
-## 0.6.15 (unreleased)
+## 0.7.1 (Unreleased)
+
+## 0.7.0
+
+ * Use source_format when looking up partials (Thanks @databyte)
+ * Add README note about render_views (Thanks @databyte)
+ * Add support for Rails 3.2+ sending custom mime types (Thanks @databyte)
+ * Add option to define his own cache_engine (Thanks @shingara)
## 0.6.14
View
4 README.md
@@ -107,6 +107,7 @@ Rabl.configure do |config|
# Commented as these are defaults
# config.cache_all_output = false
# config.cache_sources = Rails.env != 'development' # Defaults to false
+ # config.cache_engine = Rabl::CacheEngine.new # Defaults to Rails cache
# config.escape_all_output = false
# config.json_engine = nil # Any multi\_json engines
# config.msgpack_engine = nil # Defaults to ::MessagePack
@@ -131,6 +132,8 @@ output if the incoming request has a 'callback' parameter.
If `include_child_root` is set to false then child objects in the response will not include
a root node by default. This allows you to further fine-tune your desired response structure.
+If `cache_engine` is set, you should assign it to a class with a `fetch` method. See the [default engine](https://github.com/nesquena/rabl/blob/master/lib/rabl/cache_engine.rb) for an example.
+
If `cache_sources` is set to `true`, template lookups will be cached for improved performance.
The cache can be reset manually by running `Rabl.reset_source_cache!` within your application.
@@ -529,6 +532,7 @@ Thanks to [Miso](http://gomiso.com) for allowing me to create this for our appli
* [Alli Witheford](https://github.com/alzeih) - Added Plist format support
* [Ryan Bigg](https://github.com/radar) - Improved template resolution code
* [Ivan Vanderbyl](https://github.com/ivanvanderbyl) - Added general purpose renderer
+* [Cyril Mougel](https://github.com/shingara) - Added cache_engine pluggable support
and many more contributors listed in the [CHANGELOG](https://github.com/nesquena/rabl/blob/master/CHANGELOG.md).
View
12 lib/rabl/cache_engine.rb
@@ -1,6 +1,18 @@
+# Defines the default cache engine for RABL when caching is invoked for a template.
+# You can define your own caching engines by creating an object that responds to fetch and
+# setting the configuration option:
+#
+# config.cache_engine = AdvancedCacheEngine.new
+#
+
module Rabl
class CacheEngine
+ # Fetch given a key and options and a fallback block attempts to find the key in the cache
+ # and stores the block result in there if no key is found.
+ #
+ # cache = Rabl::CacheEngine.new; cache.fetch("some_key") { "fallback data" }
+ #
def fetch(key, cache_options, &block)
if defined?(Rails)
Rails.cache.fetch(key, cache_options, &block)
View
1  lib/rabl/partials.rb
@@ -74,7 +74,6 @@ def fetch_rails_source(file, options={})
# pull format directly from rails unless it is html
rendered_format = context_scope.lookup_context.rendered_format
source_format = rendered_format unless rendered_format == :html
-
context_scope.lookup_context.find(file, [], partial, [], {:formats => [source_format]})
end }
template = lookup_proc.call(false) rescue lookup_proc.call(true)
Please sign in to comment.
Something went wrong with that request. Please try again.