Flowdock
method

new

Importance_0
v3.1.0 - Show latest stable - 0 notes - Class: ActiveModel::Name
new(klass, namespace = nil, name = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/naming.rb, line 10
    def initialize(klass, namespace = nil, name = nil)
      name ||= klass.name
      super(name)
      @unnamespaced = self.sub(/^#{namespace.name}::/, '') if namespace

      @klass = klass
      @singular = _singularize(self).freeze
      @plural = ActiveSupport::Inflector.pluralize(@singular).freeze
      @element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self)).freeze
      @human = ActiveSupport::Inflector.humanize(@element).freeze
      @collection = ActiveSupport::Inflector.tableize(self).freeze
      @partial_path = "#{@collection}/#{@element}".freeze
      @param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze
      @route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural).freeze
      @i18n_key = self.underscore.to_sym
    end
Register or log in to add new notes.