When a required node is an attribute or method, it is easy to call extends.
But when it is not an attribute? It could be an instance variable or an attr accessor.
Example below:
// dispatches is an attribute of the class
child :dispatches => :dispatches do
extends "/dispatches/_base"
end
# completed post is not an attribute of the class
if @completed_post
node(:post) do |post|
{
id: @completed_post.id.to_s,
_id: @completed_post.id.to_s,
display_text: @completed_post.display_text,
# and many others
}
end
This required additional node could either be an @instance or @object[:some_attribute]
Not sure if this will help you but you can pass "locals" to extended template like so:
Then in your
posts/show
template: