nesquena/rabl — pull request #389 by ReneB (2013-01-15 12:27:53+00:00)
Title: Add configuration option to disallow missing attributes

When the configuration option is set to true, a RuntimeError is raised whenever the object being rendered does not have the attribute that is to be rendered.

This allows easier API-compliance testing at development time. One could specify that it is an error to render objects with missing attributes and easily see where it went wrong during development, but use the robustness of RABL rendering in other modes.

The alternative is using :if blocks with all your attributes, but this is a lot of yak-shaving for naught.

An example use case is combining RABL rendering with View Models or Presenters. If a developer forgets to decorate a certain object with a certain presenter, the API may break almost invisibly due to the respond_to? check for missing attributes.