mustache_rails3 icon indicating copy to clipboard operation
mustache_rails3 copied to clipboard

save Mustache Templates in Database

Open shenoudab opened this issue 14 years ago • 1 comments

Dears,

kindly, Is there a way to save Mustache Templates in Database as (CouchDB) and how to do so ? what is the advantages when using mustache instead of Liquid or ERB in Rails App ? is there any performance figures ?

Thanks, Shenouda Bertel

shenoudab avatar Jan 16 '11 22:01 shenoudab

Hi, Please, have a look at my variant on https://github.com/parallel588/mustache_rails3, it helps save Mustache Templates in Database.

To work with Database, you need to put: Mustache::Rails::Config.template_from_store = Proc.new{ |t| Page.find_by_slug(t).try(:content) || "not found" } Mustache::Rails::Config.partial_from_store = Proc.new{ |t| Snippet.find_by_slug(t).try(:content) || "not found"} in RAILS_ROOT/config/initialize/mustache.rb

Cheers, Max

parallel588 avatar Jun 23 '11 05:06 parallel588