Serialization should be testable
Agreed and with RABL serialization is testable both in and outside of a web request context. Check out the other gists in this file for examples using Rabl.render
to do standalone unit testing.
RABL can't be used for generating push notifications or in background jobs
Not at all true, I use RABL for these purposes in all of my applications. Simply use Rabl.render
to render templates in any context.
RABL is linked inextricably to or requires ActionView, Rails, or a controller
See above. Simply not at all true. Simply use Rabl.render
to render templates in any context.
Object serialization doesn't belong in templates
JSON and XML are data exchange formats and they do fundamentally represent a view of your data not unlike an HTML view or any other view format. JSON rendering in an API is a view of your data, there's no way around that. Moreso, even in other contexts outside of a controller the template is rendering an object into a representation. A ruby-based DSL such as RABL is a great way to create these representations. In addition, with RABL you can render into JSON, XML, Plist, MsgPack, et al using the same consistent templating language.
RABL templates can become complicated
As with all views, templates should not contain intricate object and model logic or complex conditionals. Views are intended to be simple representations of your objects and this is where RABL fits well into the picture. If you are worried about RABL views getting complex, you should apply best practices and extract RABL partials to reduce code duplication as with any view and use presenters to organize the code correctly.