Class: Spree::PaymentMethod::ModelName

Inherits:
ActiveModel::Name
  • Object
show all
Defined in:
app/models/spree/payment_method.rb

Overview

Custom ModelName#human implementation to ensure we don't refer to subclasses as just “PaymentMethod”

Instance Method Summary collapse

Instance Method Details

#human(options = {}) ⇒ Object

Similar to ActiveModel::Name#human, but skips lookup_ancestors



44
45
46
47
48
49
50
51
52
# File 'app/models/spree/payment_method.rb', line 44

def human(options = {})
  defaults = [
    i18n_key,
    options[:default],
    @human
  ].compact
  options = { scope: [:activerecord, :models], count: 1, default: defaults }.merge!(options.except(:default))
  I18n.translate(defaults.shift, options)
end