yield in ERB without rails

前端 未结 6 1744
轮回少年
轮回少年 2020-12-30 05:49

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 wit

6条回答
  •  星月不相逢
    2020-12-30 06:10

    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.

提交回复
热议问题