rails / jbuilder

Jbuilder: generate JSON objects with a Builder-style DSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separating jbuilder templating from Rails

markwilkinson opened this issue · comments

Hi all!
I want to be able to utilize the jbuilder templating behavior/partials OUTSIDE of a Rails app (i.e. not in a Web app at all). It seems that templates requires JbuilderTemplate, which takes as its first argument, a Rails Context. As far as I can tell, the primary purpose (or at least, one of the primary purposes) is to set the default path to look for the partials! Maybe I'm wrong, but this seems like a pretty lightweight reason to require Rails on an otherwise widely useful templating system.

Can I override this behavior, and just TELL IT where the partials are? (Or, is it possible to create a lightweight ActionView Context that would satisfy the needs of JbuilderTemplate?)

The JBuilderTemplate class was made to be used only with Rails, but you can inject anything that respond to the methods that are expected. Like controller and render