Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to annotate rails models in rails version 3.2.1

Im trying to follow some online tutorial on annotating my models in rails. However, it seems all the tutorials are either talking about outdated annotation versions or incorrect installations its a mess.

So far Ive tried the following

1) Added this in the Gemfile

gem 'annotate', '2.4.0'

2) Then the command:

bundle install

3) I then saw that the annotation gem was installed and showing up on the command

bundle show

4) lastly in order to annotate my models I used the command

bundle exec annotate --position before

At this point I was expecting my models to be annotated however what I got was the following error message:

/Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/railties/databases.rake:4:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError)
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/railtie.rb:33:in `load'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/railtie.rb:33:in `block in <class:Railtie>'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `instance_exec'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `block in load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `each'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie.rb:184:in `load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:423:in `block in load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in `each'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application/railties.rb:8:in `all'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:423:in `load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:145:in `load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from Rakefile:7:in `<top (required)>'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `load'
from /Users/AM/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `<main>'

So feeling completely stumped.

Any ideas on how to proceed?

Thanks

like image 819
banditKing Avatar asked Mar 11 '12 03:03

banditKing


1 Answers

Try using the updated beta version.

gem 'annotate', '2.4.1.beta1'
like image 90
nmott Avatar answered Sep 20 '22 21:09

nmott