aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-03 15:43:48 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-03 15:43:48 +0000
commite024f2f1bff35fb4d0630684f6985c8e7da79ce2 (patch)
tree7d1e87028d2cb49b45c013d06f920f8791d859e8 /activerecord
parent8c512a1caffa11d1522cef5d2a35e2888c608581 (diff)
downloadrails-e024f2f1bff35fb4d0630684f6985c8e7da79ce2.tar.gz
rails-e024f2f1bff35fb4d0630684f6985c8e7da79ce2.tar.bz2
rails-e024f2f1bff35fb4d0630684f6985c8e7da79ce2.zip
Correct fixture behavior when table name pluralization is off. Closes #2719.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2862 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG4
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index f0151360cf..bd14118506 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Correct fixture behavior when table name pluralization is off. #2719 [Rick Bradley <rick@rickbradley.com>]
+
* Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH]. Example:
class Account < ActiveRecord::Base
@@ -21,8 +23,6 @@
Note that the anoymous module must be declared using brackets, not do/end (due to order of evaluation).
-* A missing primary key column shouldn't raise an error when generating its error message. [Don Park <don.park@gmail.com>]
-
* Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) #2644 [Dan Peterson]
* Added migration support for Oracle #2647 [Michael Schoen]
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 3912f86ee6..8c2c0cdc3c 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -270,7 +270,7 @@ class Fixtures < YAML::Omap
def initialize(connection, table_name, fixture_path, file_filter = DEFAULT_FILTER_RE)
@connection, @table_name, @fixture_path, @file_filter = connection, table_name, fixture_path, file_filter
- @class_name = Inflector.classify(@table_name)
+ @class_name = ActiveRecord::Base.pluralize_table_names ? @table_name.singularize.camelize : @table_name.camelize
@table_name = ActiveRecord::Base.table_name_prefix + @table_name + ActiveRecord::Base.table_name_suffix
read_fixture_files
end
@@ -436,8 +436,10 @@ module Test #:nodoc:
def self.require_fixture_classes(table_names=nil)
(table_names || fixture_table_names).each do |table_name|
+ file_name = table_name.to_s
+ file_name = file_name.singularize if ActiveRecord::Base.pluralize_table_names
begin
- require Inflector.singularize(table_name.to_s)
+ require file_name
rescue LoadError
# Let's hope the developer has included it himself
end