Browse files

Adds rendering methods to readme

  • Loading branch information...
nesquena committed Apr 14, 2012
1 parent c546ba8 commit a8ee5440c05a73483ed280a145a0e11fb4c9fce9
Showing with 22 additions and 1 deletion.
  1. +22 −1
@@ -534,6 +534,26 @@ details, and if you have any ideas or patches please let me know.
In the meantime, be sure to set the proper content-types if needed. This is usually pretty simple in both
Rails and Padrino. I recommend a before_filter on that controller or directly specified in an action.
+### Rendering Templates Directly ###
+There are situations where an application requires RABL templates to be rendered outside
+a traditional view context. For instance, to render RABL within a Rake task or to create
+message queue payloads. For this case, `Rabl.render` can be used as show below:
+Rabl.render(object, template, :view_path => 'app/views', :format => :json) #=> "{...json...}"
+You can use convenience methods on `Rabl::Renderer` to render the objects as well:
+```ruby, 'posts/show', :view_path => 'app/views')
+Rabl::Renderer.json(@post, 'posts/show')
+Rabl::Renderer.xml(@post, 'posts/show')
+These methods allow RABL to be used for arbitrary conversions of an object into a desired format.
## Resources ##
There are many resources available relating to RABL including the [RABL Wiki](,
@@ -602,7 +622,7 @@ Thanks to [Miso]( for allowing me to create this for our appli
* [Nathan Esquenazi]( - Creator of the project
* [Arthur Chiu]( - Core Maintainer, Riot Testing Guru
-* [Tim Lee]( - RABL is an awesome name and was chosen by the Miso CTO.
+* [Tim Lee]( - RABL was a great name chosen by the Miso CTO.
* [David Sommers]( - Enhanced template resolution and added caching support
* [Rick Thomas]( - Added options for extends and Sinatra testing
* [Benjamin Yu]( - Added msgpack format support
@@ -615,6 +635,7 @@ Thanks to [Miso]( for allowing me to create this for our appli
* [Andrey Voronkov]( - Added BSON format support
* [Alli Witheford]( - Added Plist format support
* [Ryan Bigg]( - Improved template resolution code
+* [Ivan Vanderbyl]( - Added general purpose renderer
and many more contributors listed in the [CHANGELOG](

0 comments on commit a8ee544

Please sign in to comment.