3
轉義的模型屬性我得到了很多錯誤如下司閘員錯誤 - 近
Unescaped model attribute near line 20: show_errors(Objective.new(objective_params), :name)
擴展視圖
這是我的代碼
module ApplicationHelper
# Error Helper for Form
def show_errors(object, field_name)
if object.errors.any? && object.errors.messages[field_name][0].present?
"<label class='text-error'>" + object.errors.messages[field_name][0] + "</label>"
else
return ""
end
end
end