Permalink
Browse files

Fixes issue #14 - RuntimeError: Already memoized

  • Loading branch information...
1 parent 9ce1fd6 commit 3de59e86c958ca559950aeb01d410b32c5022a7c @eagleas eagleas committed Sep 16, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/annotate/annotate_models.rb
@@ -246,7 +246,10 @@ def get_model_files
# Check for namespaced models in subdirectories as well as models
# in subdirectories without namespacing.
def get_model_class(file)
- require File.expand_path("#{model_dir}/#{file}") # this is for non-rails projects, which don't get Rails auto-require magic
+
+ # this is for non-rails projects, which don't get Rails auto-require magic
+ require File.expand_path("#{model_dir}/#{file}") unless Module.const_defined?(:Rails)
+
model = ActiveSupport::Inflector.camelize(file.gsub(/\.rb$/, ''))
parts = model.split('::')
begin

0 comments on commit 3de59e8

Please sign in to comment.