From 65a3020851f235cac88afa215b805c2ed43f2639 Mon Sep 17 00:00:00 2001 From: Joe Goggins Date: Thu, 22 Mar 2012 10:02:08 -0500 Subject: 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 --- activerecord/lib/active_record/inheritance.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activerecord/lib/active_record/inheritance.rb') 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 abstract_class?). + # 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 + # + # + # self.abstract_class = true is required to make Child<.find,.create, or any Arel method> use the_table_i_really_want instead of a table called super_classes + # attr_accessor :abstract_class # Returns whether this class is an abstract class or not. -- cgit v1.2.3