Permalink
Browse files

Merge pull request #50 from eagleas/master

fix bug producing "Already memoized" on models
  • Loading branch information...
2 parents 9ce1fd6 + 3de59e8 commit cfeec96c9ca0fa5035b10be3d73e798cc4fc52f7 @turadg turadg committed Sep 16, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/annotate/annotate_models.rb
View
5 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 cfeec96

Please sign in to comment.