aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorthedarkone <thedarkone2@gmail.com>2010-09-26 14:54:49 +0200
committerthedarkone <thedarkone2@gmail.com>2010-09-27 17:46:00 +0200
commit9c57bd8578e5ed47f143a2755b03ffd2ef85c65d (patch)
tree578758fb982760caecd5ff91106f3a7b22ec0d4d /activemodel
parentdc09cc055ab79ec8181ec4089449c94759700e51 (diff)
downloadrails-9c57bd8578e5ed47f143a2755b03ffd2ef85c65d.tar.gz
rails-9c57bd8578e5ed47f143a2755b03ffd2ef85c65d.tar.bz2
rails-9c57bd8578e5ed47f143a2755b03ffd2ef85c65d.zip
Fix Namind#model_name.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/naming.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index fc2abacb6d..2d580fd325 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -73,8 +73,10 @@ module ActiveModel
# Returns an ActiveModel::Name object for module. It can be
# used to retrieve all kinds of naming-related information.
def model_name
- namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
- @_model_name ||= ActiveModel::Name.new(self, namespace)
+ @_model_name ||= begin
+ namespace = self.parents.detect { |n| n.respond_to?(:_railtie) }
+ ActiveModel::Name.new(self, namespace)
+ end
end
# Returns the plural class name of a record or class. Examples: