From 64003677b7063aabc2a943e75e56b48cae6b15f7 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Thu, 6 Apr 2006 16:06:38 +0000 Subject: Fix type_name_with_module to handle type names that begin with '::'. Closes #4614. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4187 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index ecad32ebe2..b91ebafee5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1000,7 +1000,7 @@ module ActiveRecord #:nodoc: # Nest the type name in the same module as this class. # Bar is "MyApp::Business::Bar" relative to MyApp::Business::Foo def type_name_with_module(type_name) - "#{self.name.sub(/(::)?[^:]+$/, '')}#{$1}#{type_name}" + (/^::/ =~ type_name) ? type_name : "#{parent.name}::#{type_name}" end def construct_finder_sql(options) -- cgit v1.2.3