0
我想创建这样一个帮手(我使用的是Formtastic宝石):结束语一个Rails 3块帮手另一个帮手
def admin_form_for(record, columns = nil, &block)
semantic_form_for [:admin, record] do |f|
f.semantic_errors
f.inputs *columns if columns
capture(f, &block) if block_given?
f.buttons
end
end
我想换块帮手admin_form_for
,我们再调用一些输出文本的方法,然后在其中间捕获一个ERB块。
我已经试过各种事情
capture(f, &block) if block_given?
和
yield f if block_given?
和
concat(capture(f, &block)) if block_given?
似乎没有任何工作。
的帮助的使用最终看起来像这样:
<%= admin_form_for @record, [:name, :email] do |f| %>
<p><%= some_other_helper %></p>
<% end %>