Module: ActiveModel::Translation
- Included in:
- Edgar::Search
- Defined in:
- lib/core_ext/active_model.rb
Instance Method Summary (collapse)
-
- (Object) human_attribute_name_with_custom_fallback(attr, opt = {})
Column label I18n as follows (User.login as example):.
Instance Method Details
- (Object) human_attribute_name_with_custom_fallback(attr, opt = {})
Column label I18n as follows (User.login as example):
-
t('activerecord.attributes.user.login')
-
t('login') # new feature added on original human_attribute_name
-
'Login'
9 10 11 12 |
# File 'lib/core_ext/active_model.rb', line 9 def human_attribute_name_with_custom_fallback(attr, opt={}) human_attribute_name_without_custom_fallback(attr, opt.merge(default: I18n.t(attr, default: attr.to_s.humanize))) end |