Permalink
Browse files

Merge pull request #50 from eagleas/master

fix bug producing "Already memoized" on models
  • Loading branch information...
turadg committed Sep 16, 2011
2 parents 9ce1fd6 + 3de59e8 commit cfeec96c9ca0fa5035b10be3d73e798cc4fc52f7
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

3 comments on commit cfeec96

@divoxx

This comment has been minimized.

Show comment Hide comment
@divoxx

divoxx Sep 11, 2012

Was this ever released? I just installed the latest and even though this method is not defined in the same line, the constant check is not there.

Was this ever released? I just installed the latest and even though this method is not defined in the same line, the constant check is not there.

@alexch

This comment has been minimized.

Show comment Hide comment
@alexch

alexch Sep 14, 2012

Collaborator

Good question! It looks like an important feature.

Collaborator

alexch replied Sep 14, 2012

Good question! It looks like an important feature.

@alexch

This comment has been minimized.

Show comment Hide comment
@alexch

alexch Sep 14, 2012

Collaborator

Good catch! It got undone during a big merge of @MrJoy's code. I'll put it back.

Collaborator

alexch replied Sep 14, 2012

Good catch! It got undone during a big merge of @MrJoy's code. I'll put it back.

Please sign in to comment.