Posts tagged OOP

Feb10

More STI Tricks

ruby OOP STI | comments

Obviously, I’ve been using STI for a recent project.

Alex Reisner has a post full of tips, a cool one being overriding the model_name class method for your parent class, so that when you do form_for @sub_class... you still get params[:parent_class] delivered to your controller.

Continue reading »

Feb08

Getting a pretty list of subclasses

ruby OOP | comments

Perhaps you are using something like Single Table Inheritance, or are simply for some other reason using a parent class with several subclasses. It can be convenient to be able to quickly get a list of the subclasses of a given parent class.

Continue reading »