27

Does anyone have any idea why annotate does not work anymore in rails 3.1 ?

When trying to run it with :

 $ rvmsudo bundle exec annotate --position before

and given I've got the following in my gemfile:

gem "annotate", '2.4.0'

I get the following error:

  /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0/lib/active_record
/railties/databases.rake:3:in `<top (required)>': undefined method `namespace' for
main:Object (NoMethodError)

I'm using RVM with a gemset dedicated to rails 3.1 with Ruby 1.9.2

vincent jacquel
  • 5,107
  • 2
  • 17
  • 18

1 Answers1

52

There's already a patch for this issue: https://github.com/ctran/annotate_models/commit/8057b920968a4c64c7d558e43834f81867329fcc

You should use the last version:

gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'

Bests,

UPDATE: It's fixed in the latest beta version at RubyGems. Use:

 gem 'annotate', '~> 2.4.1.beta' 

Thanks to Michael Hartl for this information.

Richard.P
  • 802
  • 7
  • 6
  • Richard.P, I didn't know what to do with your link, but I replace the 'annotate' line in my gemfile by your line, and it work perfectly!! Thanks a lot!!! (and sorry for my english :O) –  Oct 19 '11 at 15:31
  • Hello A.becquet, you did the right thing :-) : edit your Gemfile and replace the line "gem 'annotate'" by "gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'" – Richard.P Oct 25 '11 at 06:57
  • Thanks for this answer! I had to run $ bundle install before it worked. – Jarred Nov 11 '11 at 16:33
  • 11
    It would be really nice to get this in patch into the official gem. Otherwise I'm probably going to cut `annotate` from the [Rails Tutorial book](http://railstutorial.org/book). UPDATE: It's in the latest beta version at RubyGems. Use `gem 'annotate', '~> 2.4.1.beta'` in your `Gemfile`. – mhartl Dec 01 '11 at 02:19
  • I agree - it seems like a pretty obvious oversight – Jaco Pretorius Dec 06 '11 at 16:57
  • @mhartl +1 - I just arrived here after getting this error while working through the tut. Thankfully this was my first stop :) perhaps you might consider putting a note in the book? – yitznewton Dec 13 '11 at 03:47
  • Changing to rake '0.8.7' also seems to fix the problem – Cyrus Dec 21 '11 at 00:54