Method: Olivander::ApplicationHelper#field_label_for

Defined in:
app/helpers/olivander/application_helper.rb

#field_label_for(resource_class, sym) ⇒ Object



142
143
144
145
146
147
148
# File 'app/helpers/olivander/application_helper.rb', line 142

def field_label_for(resource_class, sym)
  sym_s = sym.to_s.gsub('.', '_')
  i18n_key = "activerecord.attributes.#{resource_class.name.underscore}.#{sym_s}"
  return O18n.t(i18n_key) if I18n.exists?(i18n_key)

  sym.to_s.titleize
end