Skip to content

Instantly share code, notes, and snippets.

@ootoovak
Last active December 13, 2015 17:48
Show Gist options
  • Save ootoovak/4950519 to your computer and use it in GitHub Desktop.
Save ootoovak/4950519 to your computer and use it in GitHub Desktop.
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
@ootoovak
Copy link
Author

I may try switch to Virtus (if it serves the same role) instead of Active Attribute down the line as it has more commiters and activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment