nesquena / rabl

General ruby templating with json, bson, xml, plist and msgpack support
http://blog.codepath.com/2011/06/27/building-a-platform-api-on-rails/
MIT License
3.64k stars 333 forks source link

Caching with multiple extends #620

Open futbolpal opened 9 years ago

futbolpal commented 9 years ago

It seems not possible to use multiple extends with caching. It appears that only the first extends is included in the output. Using extends looks cleaner to me than using partials, because with extends I can include the node tag and guarantee a consistent hierarchy structure. Any thoughts or different approaches recommended?

Example:

  1 object @object
  2     extends("v1/base")
  3     extends("v1/common/partials/follows")
  4     extends("v1/common/partials/changelog")
  5     extends("v1/common/partials/tags")

Instead of

  1 object @object
  2     extends("v1/base")
  3 
  4     node :follows do |o|
  5         partial("v1/common/partials/follows", :object => o.follows)
  6     end 
  7 
  8     node :changelog do |o| 
  9         partial("v1/common/partials/changelog", :object => o.changelog)
 10     end  
 11     
 12     node :tags do |o|
 13         partial("v1/common/partials/tags", :object => o.tags)
 14     end  
futbolpal commented 8 years ago

@nesquena any thoughts on this? Let me know if I can clarify further

nesquena commented 8 years ago

You are correct, this is a limitation of the current caching system which certainly needs some significant work when combined with partials. Unfortunately, I don't have the bandwidth to improve the caching mechanism myself. I would very much appreciate help from additional contributors that stumble upon this ticket. Sorry I can't be of more help.