我正在使用辅助方法
def edit(rad_visit, html_options = {})
unless (rad_visit.cached_rad_status.status_name == "CANCELLED" || business_partner_signed_in?)
link_to "Edit", edit_rad_visit_path(rad_visit.id), {:disable_with => "Please wait...", :class=>"btn btn-success"}
end
end
如何在一页中将此辅助方法称为<%= edit(@rad_visit)%>
(没有html选项)
在另一页中
<%= edit(@rad_visit)%>
(使用html选项{:disable_with => "Please wait...", :class=>"btn btn-success"}
)
提前致谢..
答案 0 :(得分:3)
编辑你的助手看起来像这样:
def edit(rad_visit, html_options = {})
unless (rad_visit.cached_rad_status.status_name == "CANCELLED" || business_partner_signed_in?)
link_to "Edit", edit_rad_visit_path(rad_visit.id), html_options
end
end
然后像这样称呼它:
<%= edit(@rad_visit)%>
或
<%= edit(@rad_visit, {:disable_with => "Please wait...", :class=>"btn btn-success"})%>