This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
# StiFactory # # StiFactory converts the #new method of an ActiveRecord class into a subclass-aware factory method. # The factory returns a new instance of the superclass or subclass based on the presence of the # inheritance_column in the attribute list when #new is called. If the value of the # inheritance_column attribute is a valid subclass of the superclass then a new instance of the # subclass will be returned, otherwise a new instance of the superclass will be returned. # # The intention for this is to allow users to select the subclass in a form and allow the corresponding # controller to build or create an instance of the subclass without having to know that STI is # involved. # # # Example: # class Vehicle < ActiveRecord::Base # self.inheritance_column = 'vehicle_type' # has_sti_factory # end # # class Car < Vehicle; end # class Truck < Vehicle; end # class MonsterTruck < Truck; end # # Vehicle.new # #<Vehicle id: nil, vehicle_type: nil, ...> # # Vehicle.new :vehicle_type => 'Truck' # #<Truck id: nil, vehicle_type: 'Truck', ...> # # Vehicle.new :vehicle_type => 'MonsterTruck' # #<MonsterTruck id: nil, vehicle_type: 'MonsterTruck', ...>












