aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/CHANGELOG3
-rw-r--r--activesupport/lib/active_support/inflector.rb3
2 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 59fc6c27ed..f796774f0f 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,6 +1,9 @@
*SVN*
+* Strip out leading schema name in classify. References #5139. [schoenm@earthlink.net]
+
* Remove Enumerable#first_match since break(value) handles the use case well enough. [Nicholas Seckar]
+
Enumerable#first_match was like detect, but instead of returning the matching element, the yielded value returned. For example:
user_xml = adapters(:from => User, :to => Xml).first_match do |adapter|
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index ce36d3ef54..54b9e064ac 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -146,7 +146,8 @@ module Inflector
end
def classify(table_name)
- camelize(singularize(table_name))
+ # strip out any leading schema name
+ camelize(singularize(table_name.sub(/.*\./, '')))
end
def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)