method
new
v7.1.3.2 -
Show latest stable
- Class:
Rails::Generators::ModelHelpers
new(args, *_options)public
No documentation available.
# File railties/lib/rails/generators/model_helpers.rb, line 26
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