diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-31 14:31:03 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-02 22:27:03 +0100 |
commit | f50bb48e048b63186684e220b03235936e646ea5 (patch) | |
tree | 0dd31ece0be9ddaceb7a0bc1c8f661ae1efb2cb5 /actionpack | |
parent | bef968d37942bfb2b7a59fca0e4451e096197c0a (diff) | |
download | rails-f50bb48e048b63186684e220b03235936e646ea5.tar.gz rails-f50bb48e048b63186684e220b03235936e646ea5.tar.bz2 rails-f50bb48e048b63186684e220b03235936e646ea5.zip |
Do not enforce human_attribute_name as required API.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 9baa9f1fff..81c9c88820 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -777,12 +777,15 @@ module ActionView 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) |