无轨电收率 [英] yield in ERB without rails
本文介绍了无轨电收率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在erb中使用 yield 进行模板继承?我想在普通的ruby CGI脚本中使用erb,并想使用基本模板和子模板,例如Rails和应用程序模板。
解决方案
我认为您不能-Rails将基础设施作为actionpack的一部分。
您可能能够做的就是获取actionpack并将其添加到您的脚本。
或者您可以自己滚动轻量级的模板系统。
或者使用Rails或Merb或Sinatra。 / p>
How can I use yield for template inheritance in erb? I want to use erb in a plain ruby CGI script and want to use a base template and subtemplate like it Rails with the application template does.
解决方案
I don't think you can - Rails provides that infrastructure as part of actionpack.
What you may be able to do is take actionpack and add it into your script.
Alternatively you could roll a lightweight templating system yourself.
Alternatively alternatively use Rails or Merb or Sinatra.
这篇关于无轨电收率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文