ccocchi / rabl-rails

Rails 4.2+ templating system with JSON, XML and Plist support.
MIT License
209 stars 51 forks source link

child() should be nil aware #26

Closed fakingfantastic closed 11 years ago

fakingfantastic commented 11 years ago

Recently I was working on a template with a parent / child... let's say Post / Author.

object :@post attribute(:name) child :author do extends "author/base" end

This will render the child block even if @post.author.nil?, which will throw an error.

Shouldn't child() be aware if the relationship is nil?