1
0
Fork 0
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:
thedarkone 2010-09-26 14:54:49 +02:00
parent dc09cc055a
commit 9c57bd8578

View file

@ -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
namespace = self.parents.detect { |n| n.respond_to?(:_railtie) } @_model_name ||= begin
@_model_name ||= ActiveModel::Name.new(self, namespace) namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
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: