mustache_rails3
mustache_rails3 copied to clipboard
save Mustache Templates in Database
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
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