提交 f50bb48e 编写于 作者: J José Valim

Do not enforce human_attribute_name as required API.

上级 bef968d3
......@@ -777,12 +777,15 @@ def to_label_tag(text = nil, options = {})
options["for"] ||= name_and_id["id"]
content = if text.blank?
i18n_label = I18n.t("views.labels.#{object_name}.#{method_name}", :default => "")
i18n_label if i18n_label.present?
I18n.t("views.labels.#{object_name}.#{method_name}", :default => "").presence
else
text.to_s
end
content ||= object.class.human_attribute_name(method_name) if object
content ||= if object && object.class.respond_to?(:human_attribute_name)
object.class.human_attribute_name(method_name)
end
content ||= method_name.humanize
label_tag(name_and_id["id"], content, options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册