mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix Namind#model_name.
This commit is contained in:
parent
dc09cc055a
commit
9c57bd8578
1 changed files with 4 additions and 2 deletions
|
@ -73,8 +73,10 @@ module ActiveModel
|
||||||
# Returns an ActiveModel::Name object for module. It can be
|
# Returns an ActiveModel::Name object for module. It can be
|
||||||
# used to retrieve all kinds of naming-related information.
|
# used to retrieve all kinds of naming-related information.
|
||||||
def model_name
|
def model_name
|
||||||
|
@_model_name ||= begin
|
||||||
namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
|
namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
|
||||||
@_model_name ||= ActiveModel::Name.new(self, namespace)
|
ActiveModel::Name.new(self, namespace)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the plural class name of a record or class. Examples:
|
# Returns the plural class name of a record or class. Examples:
|
||||||
|
|
Loading…
Reference in a new issue