aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
-rw-r--r--railties/test/application/model_initialization_test.rb (renamed from railties/test/model_initialization_test.rb)0
2 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 8542c52d0c..9ed53cc4af 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -932,7 +932,7 @@ module ActiveRecord #:nodoc:
end
def attribute_method?(attribute)
- super || column_names.include?(attribute.to_s.sub(/=$/, ''))
+ super || (table_exists? && column_names.include?(attribute.to_s.sub(/=$/, '')))
end
# Set the lookup ancestors for ActiveModel.
diff --git a/railties/test/model_initialization_test.rb b/railties/test/application/model_initialization_test.rb
index 6a22f8d8df..6a22f8d8df 100644
--- a/railties/test/model_initialization_test.rb
+++ b/railties/test/application/model_initialization_test.rb