aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorJoe Goggins <goggins@umn.edu>2012-03-22 10:02:08 -0500
committerJoe Goggins <goggins@umn.edu>2012-03-22 10:02:08 -0500
commit65a3020851f235cac88afa215b805c2ed43f2639 (patch)
tree88249d77bcde91fda3be076654a4aac447abd2e1 /activerecord/lib/active_record/inheritance.rb
parentd3223b5b65c50e675da3f5d4726a5baa0d9f2010 (diff)
downloadrails-65a3020851f235cac88afa215b805c2ed43f2639.tar.gz
rails-65a3020851f235cac88afa215b805c2ed43f2639.tar.bz2
rails-65a3020851f235cac88afa215b805c2ed43f2639.zip
Adding documentation for ActiveRecord::Base.abstract_class to clarify a particular usecase for this feature (to allow you to use inheritance in ActiveRecord without using the STI table name
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index ebe244c6a6..46d253b0a7 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -48,6 +48,20 @@ module ActiveRecord
end
# Set this to true if this is an abstract class (see <tt>abstract_class?</tt>).
+ # If you are using inheritance with ActiveRecord and don't want child classes
+ # to utilize the implied STI table name of the parent class, this will need to be true.
+ # For example, given the following:
+ #
+ # class SuperClass < ActiveRecord::Base
+ # self.abstract_class = true
+ # end
+ # class Child < SuperClass
+ # self.table_name = 'the_table_i_really_want'
+ # end
+ #
+ #
+ # <tt>self.abstract_class = true</tt> is required to make <tt>Child<.find,.create, or any Arel method></tt> use <tt>the_table_i_really_want</tt> instead of a table called <tt>super_classes</tt>
+ #
attr_accessor :abstract_class
# Returns whether this class is an abstract class or not.