Module: Spree::TypeLabels

Extended by:
ActiveSupport::Concern
Included in:
CollectionRule, CommissionRule, DeliveryMethodRule, OrderRoutingRule, PromotionAction, PromotionRule, SellerRequirement
Defined in:
app/models/concerns/spree/type_labels.rb

Overview

Names and describes each kind in a family of typed subclasses (promotion rules, collection rules, …) from one translation scope keyed by api_type, so the /types endpoints and dashboard pickers label extension kinds the same way as built-in ones.

class Spree::PromotionRule < Spree.base_class
include Spree::TypeLabels
self.type_labels_scope = 'spree.promotion_rule_types'
end

Spree::Promotion::Rules::Currency.human_name # => spree.promotion_rule_types.currency.name

Instance Method Summary collapse

Instance Method Details

#human_description ⇒ String

Returns:

  • (String)


36
# File 'app/models/concerns/spree/type_labels.rb', line 36

def human_description = self.class.human_description

#human_name ⇒ String

Returns:

  • (String)


33
# File 'app/models/concerns/spree/type_labels.rb', line 33

def human_name = self.class.human_name