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 %>