ctran / annotate_models

Annotate Rails classes with schema and routes info
Other
4.41k stars 601 forks source link

Rails 3.1 problem, i suppose. #41

Closed rafamvc closed 13 years ago

rafamvc commented 13 years ago

When I try to annotate It doesnt work. The error says namespace, but I believe it is not related with routes.

/Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activerecord-3.1.0.rc4/lib/active_record/railties/databases.rake:3:in <top (required)>': undefined methodnamespace' for main:Object (NoMethodError) from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in load' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:inblock in load' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in block in load_dependency' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:innew_constants_in' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in load_dependency' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:inload' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/activerecord-3.1.0.rc4/lib/active_record/railtie.rb:26:in block in <class:Railtie>' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:incall' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in block in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:ineach' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:inblock in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in each' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:inall' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:inmethod_missing' from Rakefile:7:in <top (required)>' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/lib/annotate.rb:17:inload' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/lib/annotate.rb:17:in load_tasks' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/gems/annotate-2.4.0/bin/annotate:66:in<top (required)>' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/bin/annotate:19:in load' from /Users/rafamvc/Developer/.rvm/gems/ruby-1.9.2-p136@railspre/bin/annotate:19:in

'

vongruenigen commented 13 years ago

I also have the same issue on rails 3.1.rc5.

@rafamvc: There's a quick workaround for it. Just include it like that in your gemfile gem 'annotate', :git => 'git://github.com/jeremyolliver/annotate_models.git', :branch => 'rake_compatibility'

Now you can execute it with bundle exec annotate.

@ctran: You've already merged a patch for that issue in #29. Why is it lost?

rafamvc commented 13 years ago

thank you!

rafamvc commented 13 years ago

:)

fayimora commented 13 years ago

OMG i almost killed myself! Now i know its a rails 3.1 problem.. thanks @vongruenigen

ctran commented 13 years ago

I'm not sure why it's lost. Will check.

vongruenigen commented 13 years ago

@ctran: I just checked the source and saw that the changes are not lost.

ctran commented 13 years ago

Thanks.

fayimora commented 13 years ago

So can we use it with Rails3.1 now?

vongruenigen commented 13 years ago

@ctran, sorry, maybe my hint was a lil bit confusing. The changes of the old patch are not lost, but there's another problem now. If I use it with Rails 3.1, I get the following error (same like @rafamvc):

/Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:3:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError)
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/railtie.rb:26:in `load'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/railtie.rb:26:in `block in <class:Railtie>'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie.rb:183:in `call'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie.rb:183:in `block in load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie.rb:183:in `each'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie.rb:183:in `load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/engine.rb:395:in `block in load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/railties.rb:8:in `each'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application/railties.rb:8:in `all'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/engine.rb:395:in `load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/application.rb:99:in `load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from Rakefile:7:in `<top (required)>'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `load'
    from /Users/dvg/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `<main>'

I will try to fix it. Maybe you've got an ide what the problem could be @ctran?

@fayimora: No you can't use the master branch with Rails 3.1, but the other solution which I've mentioned above will work properly.

stephanschielke commented 13 years ago

gem 'annotate', '2.4.1.beta1'

works for me

ghost commented 13 years ago

@DeusExMachina -- that worked for me too. Thanks -- this problem was starting to drive me nuts! :-)

rahulcn commented 13 years ago

Thakz guys!...

ghost commented 12 years ago

thanks vongruenigen! worked like a charm.

fayimora commented 12 years ago

@vongruenigen I tried but i still keep getting errors.. Am using rails3.1.1 and i used this on my gem fil

#gem 'annotate', :git => 'git://github.com/jeremyolliver/annotate_models.git', :branch => 'rake_compatibility'

nd i get this when i run annotate:

fayimora [test_app]$ bundle exec annotate --position before
/Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/railties/databases.rake:3:in `': undefined method `namespace' for main:Object (NoMethodError)
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/railtie.rb:26:in `load'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/railtie.rb:26:in `block in '
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `call'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `block in load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `each'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:396:in `block in load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/railties.rb:8:in `each'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/railties.rb:8:in `all'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/engine.rb:396:in `load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:103:in `load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from Rakefile:7:in `'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/gems/annotate-2.4.0/bin/annotate:66:in `'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `load'
    from /Users/fayimora/.rvm/gems/ruby-1.9.2-p290/bin/annotate:19:in `
'

any help??

EDIT****

Just realised you have to run

bundle exec annotate
and not
annotate
Does anyone know how i can make it automatically run the command every time i migrate?

sketchc89 commented 12 years ago

@DeusExMachina, thanks a lot that worked great.

rayhatfield commented 12 years ago

gem 'annotate', '2.4.1.beta1'

worked for me too. thanks!

beornborn commented 12 years ago

https://github.com/ctran/annotate_models/issues/41#issuecomment-2005469 this works, thank's

theoryshaw commented 12 years ago

gem 'annotate', '2.4.1.beta1' worked for me too. thanks!