method

new

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: ModelHelpers
new(args, *_options) public

No documentation

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

Hide source
# File railties/lib/rails/generators/model_helpers.rb, line 25
      def initialize(args, *_options)
        super
        if plural_model_name?(name) && !options[:force_plural]
          singular = name.singularize
          unless ModelHelpers.skip_warn
            say PLURAL_MODEL_NAME_WARN_MESSAGE % [name, singular]
          end
          name.replace singular
          assign_names!(name)
        end
        if inflection_impossible?(name)
          option1 = name.singularize.underscore
          option2 = name.pluralize.underscore.singularize
          raise Error, INFLECTION_IMPOSSIBLE_ERROR_MESSAGE % [name, option1, option2]
        end
        if irregular_model_name?(name) && ! ModelHelpers.skip_warn
          say IRREGULAR_MODEL_NAME_WARN_MESSAGE % [name.pluralize]
        end
        ModelHelpers.skip_warn = true
      end
Register or log in to add new notes.