Something I'm working with at the moment. WIP
require 'active_attr'
RELATIVE_APP_PATH = File.expand_path("../../app", __FILE__)
def construct_require_path(middle_path, name)
"#{RELATIVE_APP_PATH}/#{middle_path}/#{name}.rb"
end
def require_model(name)
require construct_require_path('models', name)
end
def require_controller(name)
require construct_require_path('controllers', name)
end
def required_constants(class_names)
class_names.each do |class_name|
unless Object.const_defined?(class_name)
Object.const_set(class_name, Class.new)
end
end
end