class AbstractTopLevelController < ApplicationController class_inheritable_accessor :model def index model.classify.constantize.all end end class AbstractNestedController < ApplicationController class_inheritable_accessor :model class_inheritable_accessor :parent def index parent.classify.constantize.find(params["#{parent}_id".to_sym].send(model).all end end class FooController < AbstractTopLevelController self.model = "foo" end class NestedFooController < AbstractNestedController self.model = "foo" self.parent = "bar" end