我希望在方法助手中有一个条件类
product_helper.rb
CREATE VIEW [dbo].[Summary]
AS
SELECT *
FROM [OriginalSummary] ot
WHERE EXISTS (SELECT 1 FROM [RecordOwner]
WHERE [Id] = ot.[MasterId] AND [Owner] = 'corp1')
GO
但是我得到了这个错误:
def product_icon
...
elsif product.sent?
'<div class="green-text <%= 'middle' if current_action?(controller: 'products', action: 'index')" %> ><i class="fa fa-envelope-o" aria-hidden="true"></i></div>'.html_safe
end
答案 0 :(得分:0)
您是帮助者,因此无法使用<%= ... %>
但需要使用#{....}
你的助手应该退回:
return "<div class='green-text <%= 'middle' if current_action?(controller: 'products', action: 'index')'%>><i class='fa fa-envelope-o' aria-hidden='true'></i></div>".html_safe