我用foo輔助函數在我看來轉義HTML字符: <%= foo ["hello", "stack", "overflow"] %>
當foo的定義是這樣的: def foo(arr)
result = ''
arr.each do |a|
result += content_tag(:div, a)
end
result
end
頁面呈現:
傢伙我有一個輔助方法,在ApplicationController中如下 class ApplicationController < ActionController::Base
helper_method :current_user
end
而且我想它調用在我的模型(假設項目)如下: class Project < ActiveRecord::Base
after_sa