aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-06-27 20:44:39 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-06-27 20:44:39 -0700
commit9921eca51cfc72c58c127973f75d71febf01d526 (patch)
tree700aa0eb73aaf602bfae328a0794c414cb5e225a /activerecord/lib/active_record/base.rb
parent4006e738ed4aeb7f99ebcff78f226508085b2854 (diff)
downloadrails-9921eca51cfc72c58c127973f75d71febf01d526.tar.gz
rails-9921eca51cfc72c58c127973f75d71febf01d526.tar.bz2
rails-9921eca51cfc72c58c127973f75d71febf01d526.zip
remove the check for needs_type_condition? because ensure_proper_type will pick up the type column
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 1f8a99d2e4..cba1058315 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1906,8 +1906,9 @@ MSG
# do Reply.new without having to set <tt>Reply[Reply.inheritance_column] = "Reply"</tt> yourself.
# No such attribute would be set for objects of the Message class in that example.
def ensure_proper_type
- unless self.class.descends_from_active_record?
- write_attribute(self.class.inheritance_column, self.class.sti_name)
+ klass = self.class
+ if klass.finder_needs_type_condition?
+ write_attribute(klass.inheritance_column, klass.sti_name)
end
end