【问题标题】:Find how many yields and their names查找产量及其名称
【发布时间】:2011-05-01 11:21:15
【问题描述】:

Rails 中是否有办法找出布局中定义了多少产量及其对应的名称?

【问题讨论】:

  • 在 Rails 中不是一种方法,但 Steve 的回答可以正常工作。

标签: ruby-on-rails layout yield


【解决方案1】:
grep -c yield < layout.html.erb

这应该会让你得到你正在寻找的计数。

【讨论】:

    【解决方案2】:

    或ack "yield" app/views/layouts/。见Ack - Better thanGrep

    【讨论】:

      猜你喜欢
      • 2021-12-28
      • 2017-01-21
      • 2016-09-02
      • 2012-12-25
      • 1970-01-01
      • 1970-01-01
      • 2017-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多