Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't annotate models using memoization. #14

Closed
jmcnevin opened this issue Aug 12, 2010 · 11 comments
Closed

Can't annotate models using memoization. #14

jmcnevin opened this issue Aug 12, 2010 · 11 comments
Labels

Comments

@jmcnevin
Copy link
Contributor

If you're using memoize inside of an AR model, you will receive the following error during annotation.

Unable to annotate [MODEL].rb: #<RuntimeError: Already memoized [METHOD]>

@ctran
Copy link
Owner

ctran commented Feb 9, 2011

Can you provide a sample model?

@leonid-shevtsov
Copy link

class Whatever < ActiveRecord::Base
  # attributes don't matter

  # look up rdocs on this
  extend ActiveSupport::Memoizable

  def some_heavy_method
    return 'whatever'
  end
  memoize :some_heavy_method

end

Looks like you're loading the class twice.

@thibaudgg
Copy link

I have the same problem with Rails 3.0.5 & Ruby 1.9.2.
Is this gem still maintained? I hope so, because I love it :)

@ctran
Copy link
Owner

ctran commented Mar 19, 2011

I'll see what I can do.

@thibaudgg
Copy link

Great, thanks!

@glennr
Copy link

glennr commented Jul 20, 2011

+1 for this

@agibralter
Copy link

+1

@todd-a-jacobs
Copy link

+1. Still having issues with Rails 3.0.10, Ruby 1.8.7-p302, and annotate 2.4.0.

@eagleas
Copy link
Contributor

eagleas commented Sep 16, 2011

+1. Same problem.

@turadg
Copy link
Contributor

turadg commented Sep 16, 2011

Thanks @eagleas. I've merged your fix.

If the problem persists for anyone, please reopen this ticket.

@turadg turadg closed this as completed Sep 16, 2011
@adie
Copy link

adie commented Feb 17, 2012

I still have this problem, installed gem with
gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'
I've checked that I use the last commit, a43c08f
Rails 3.0.10, ree-1.8.7-2011.12

alexch added a commit to alexch/annotate_models that referenced this issue Mar 24, 2012
* ctran: (23 commits)
  Inserting newline requires double-quoted string
  Annotation position defaulted to 'before'. Bugfix: annotate_models.rake uses string instead of symbol.
  include ActiveSupport to finish build ctran#45
  include lib specs
  specify :rubygems source in Gemfile for Travis
  Gemfile for dependencies for Travis CI rake
  make the specs pass (one pending)
  fix column pattern
  Allow task loading from Rakefile for gems (plugin installation already auto-detects). Add skip_on_db_migrate option as well for people that don't want it.
  Fix options parsing to convert strings to proper booleans. Change annotate to use options hash instead of ENV.
  Update README.rdoc to mention Fabrication support
  Add support for Fabrication fabricators
  We had stripped the trailing newlines from our Schema Information section. This small fix supports that case.
  rake task is 'build', not 'gem'
  match indexes and column options too when comparing annotation headers
  Leave magic encoding comment intact
  Fixes issue ctran#14 - RuntimeError: Already memoized
  Count a model as 'annotated' if any of its tests/fixtures are annotated
  Implement FactoryGirl (ctran#47)
  fix gemspec and get rspecs partly working again
  ...

Conflicts:
	Gemfile
	Rakefile
	VERSION.yml
	annotate.gemspec
	lib/tasks/annotate_models.rake
	spec/annotate/annotate_models_spec.rb
	spec/spec_helper.rb
@ctran ctran added the reviewed label Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants