Sha256: a18fa12480b937a1bd5335618a92265e14ab62dd79ecf5ef7767e0cf9c700876

Contents?: true

Size: 443 Bytes

Versions: 3

Compression:

Stored size: 443 Bytes

Contents

# frozen_string_literal: true

module Auxilium
  module Concerns
    module ModelNameShortcuts
      extend ActiveSupport::Concern

      included do
        delegate :singular_model_name, :plural_model_name, to: :class
      end

      class_methods do
        def singular_model_name
          model_name.human(count: 1)
        end

        def plural_model_name
          model_name.human(count: 2)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auxilium-3.0.31 lib/auxilium/concerns/model_name_shortcuts.rb
auxilium-3.0.30 lib/auxilium/concerns/model_name_shortcuts.rb
auxilium-3.0.24 lib/auxilium/concerns/model_name_shortcuts.rb