aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-04-06 16:06:38 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-04-06 16:06:38 +0000
commit64003677b7063aabc2a943e75e56b48cae6b15f7 (patch)
tree00bd7f2a6ab6ddf96f4a8026d41a20573431a094 /activerecord/lib/active_record
parent9935a3561e0bc9f356b8c0213cec65fc853fd7d6 (diff)
downloadrails-64003677b7063aabc2a943e75e56b48cae6b15f7.tar.gz
rails-64003677b7063aabc2a943e75e56b48cae6b15f7.tar.bz2
rails-64003677b7063aabc2a943e75e56b48cae6b15f7.zip
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
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
1 files changed, 1 insertions, 1 deletions
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)