matthewrudy / memoist

ActiveSupport::Memoizable with a few enhancements
MIT License
921 stars 99 forks source link

Memoizable causes annotate gem to fail #21

Closed mikebaldry closed 9 years ago

mikebaldry commented 10 years ago

When running annotate, it causes the model not to be annotated when it includes Memoizable and uses it on a method.

In the output:

Unable to annotate user.rb: The method source_uris is already memoized

matthewrudy commented 10 years ago

really @brightbits? I'm not very good (any good?) at keeping up with these issues.

matthewrudy commented 10 years ago

does annotate deliberately load the file again?

matthewrudy commented 10 years ago

The only way to solve this would be to avoid raising the AlreadyMemoizedError and instead just log to warn.

Not sure if that would cause issues for any existing users.

pboling commented 10 years ago

I have seen that error with annotate as well, but have been able to work around it by fixing other things. I don't remember what specifically I had to upgrade or change, but I still use both and with no problems.

pboling commented 9 years ago

@matthewrudy This error is preventing me from using the guard gem with my test suite as well.

Exception encountered: #<Memoist::AlreadyMemoizedError: Already memoized valid?>
backtrace:
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:99:in `block (2 levels) in memoize'
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:27:in `class_eval'
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:27:in `memoist_eval'
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:95:in `block in memoize'
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:91:in `each'
/Users/pboling/.rvm/gems/ruby-2.1.2@archer/gems/memoist-0.11.0/lib/memoist.rb:91:in `memoize'
/Users/pboling/Documents/trumaker/archer/app/api/trumaker_api/authentication/strategies/form_strategy.rb:24:in `<class:FormStrategy>'