mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
no need to freeze things all the time
This commit is contained in:
parent
6289f455ae
commit
65f4d8019f
1 changed files with 7 additions and 8 deletions
|
@ -25,18 +25,17 @@ module ActiveModel
|
||||||
|
|
||||||
@unnamespaced = @name.sub(/^#{namespace.name}::/, '') if namespace
|
@unnamespaced = @name.sub(/^#{namespace.name}::/, '') if namespace
|
||||||
@klass = klass
|
@klass = klass
|
||||||
@singular = _singularize(@name).freeze
|
@singular = _singularize(@name)
|
||||||
@plural = ActiveSupport::Inflector.pluralize(@singular).freeze
|
@plural = ActiveSupport::Inflector.pluralize(@singular)
|
||||||
@element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(@name)).freeze
|
@element = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(@name))
|
||||||
@human = ActiveSupport::Inflector.humanize(@element).freeze
|
@human = ActiveSupport::Inflector.humanize(@element)
|
||||||
@collection = ActiveSupport::Inflector.tableize(@name).freeze
|
@collection = ActiveSupport::Inflector.tableize(@name)
|
||||||
@param_key = (namespace ? _singularize(@unnamespaced) : @singular).freeze
|
@param_key = (namespace ? _singularize(@unnamespaced) : @singular)
|
||||||
@i18n_key = @name.underscore.to_sym
|
@i18n_key = @name.underscore.to_sym
|
||||||
|
|
||||||
@route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural.dup)
|
@route_key = (namespace ? ActiveSupport::Inflector.pluralize(@param_key) : @plural.dup)
|
||||||
@singular_route_key = ActiveSupport::Inflector.singularize(@route_key).freeze
|
@singular_route_key = ActiveSupport::Inflector.singularize(@route_key)
|
||||||
@route_key << "_index" if @plural == @singular
|
@route_key << "_index" if @plural == @singular
|
||||||
@route_key.freeze
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Transform the model name into a more humane format, using I18n. By default,
|
# Transform the model name into a more humane format, using I18n. By default,
|
||||||
|
|
Loading…
Reference in a new issue