Sha256: 028eec236ae4f20cab048eec7921ae5ade10057c991732ac78fbfd1c9ca0b9dd

Contents?: true

Size: 480 Bytes

Versions: 20

Compression:

Stored size: 480 Bytes

Contents

module ActiveSupport
  class ModelName < String
    attr_reader :singular, :plural, :partial_path

    def initialize(name)
      super
      @singular = underscore.tr('/', '_').freeze
      @plural = @singular.pluralize.freeze
      @partial_path = "#{tableize}/#{demodulize.underscore}".freeze
    end
  end

  module CoreExt
    module Module
      module ModelNaming
        def model_name
          @model_name ||= ModelName.new(name)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
3mix-castronaut-0.5.0.2 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
masover-castronaut-0.4.4.4 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
masover-castronaut-0.4.4.5 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
masover-castronaut-0.5.0.1 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.1 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.2 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.3 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.4 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.5 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.4.6 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.5.0 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.5.1 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.5.2 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.5.3 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
relevance-castronaut-0.5.4 vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb
radiant-0.7.2 vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb
activesupport-2.1.1 lib/active_support/core_ext/module/model_naming.rb
activesupport-2.1.2 lib/active_support/core_ext/module/model_naming.rb
radiant-0.7.0 vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb
radiant-0.7.1 vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb