goodmike / mustache_rails3

mustache_rails3 provides a template handler and generators for Rails 3.
Other
54 stars 23 forks source link

save Mustache Templates in Database #3

Open shenoudab opened 13 years ago

shenoudab commented 13 years ago

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

parallel588 commented 13 years ago

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