Skip to content

Instantly share code, notes, and snippets.

@chrise86
Forked from aaronvb/gist:1087368
Last active December 12, 2015 00:19
Show Gist options
  • Save chrise86/4683272 to your computer and use it in GitHub Desktop.
Save chrise86/4683272 to your computer and use it in GitHub Desktop.
if Rails.env == "development"
Dir.foreach("#{Rails.root}/app/models") do |model_name|
require_dependency model_name unless model_name == "." || model_name == ".."
end
end
# or for nested models
if Rails.env == "development"
Dir.glob("#{Rails.root}/app/models/**/*.rb") do |model_name|
require_dependency model_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment