Skip to content

Commit

Permalink
Adding documentation for ActiveRecord::Base.abstract_class to clarify…
Browse files Browse the repository at this point in the history
… a particular usecase for this feature (to allow you to use inheritance in ActiveRecord without using the STI table name
  • Loading branch information
Joe Goggins committed Mar 22, 2012
1 parent d3223b5 commit 65a3020
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions activerecord/lib/active_record/inheritance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ def base_class
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.
Expand Down

0 comments on commit 65a3020

Please sign in to comment.