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

Does it work with rails 3.1rc? #28

Closed
swachian opened this issue Jun 10, 2011 · 29 comments
Closed

Does it work with rails 3.1rc? #28

swachian opened this issue Jun 10, 2011 · 29 comments

Comments

@swachian
Copy link

For the first time I use this gem. I find it work on a project with rails3.0, yet I fail to make it run with rails3.1. The rails version I use include 3.1.0.rc4 and 3.1.0.rc3.

The error I get is like:

ree-1.8.7-2011.03@r310/gems/activerecord-3.1.0.rc4/lib/active_record/railties/databases.rake:3: undefined method `namespace' for main:Object (NoMethodError)
.....

        from ./Rakefile:7
        from /.rvm/gems/ree-1.8.7-2011.03@r310/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
@manuelmeurer
Copy link
Contributor

Same problem here with Ruby 1.9.2 and Rails 3.1.0.rc4

/Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activerecord-3.1.0.rc4/lib/active_record/railties/databases.rake:3:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError)
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `block in load'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/activerecord-3.1.0.rc4/lib/active_record/railtie.rb:26:in `block in <class:Railtie>'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `call'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `block in load_tasks'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `each'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `load_tasks'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in `block in load_tasks'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in `each'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in `all'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in `load_tasks'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from Rakefile:7:in `<top (required)>'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/bin/annotate:19:in `load'
    from /Users/manuel/.rvm/gems/ruby-1.9.2-p180@rails-3.1/bin/annotate:19:in `<main>'

@ctran
Copy link
Owner

ctran commented Jun 15, 2011

Anyone care to patch?

@manuelmeurer
Copy link
Contributor

Sure, if you give me a pointer to what the problem might be. :)
It's deep in Rails so it might be a Rails issue?
Or must some dependency be loaded first in annotate-2.4.0/lib/annotate.rb?

@jeremyolliver
Copy link
Contributor

Just encountered the same issue. I suspect it's more to do with rake 0.9, than rails 3.1 The rake task loading changed from 0.8.7 to 0.9.X Some rake methods were namespaced into Rake::DSL so include Rake::DSL if defined?(Rake::DSL) might help, though I haven't tried this yet.

I might have a play with patching/fixing this later

@manuelmeurer
Copy link
Contributor

Didn't work for me. I tried inserting include Rake::DSL in different places to no avail...

@jeremyolliver
Copy link
Contributor

Started on trying out a patch just now, but missing a few dev tools as I'm on a new computer, I'll continue this later.

For anyone else trying to write a patch, it took a bit for me to work out what the development dependencies for annotate are, so I added them to the gemspec, and corrected a couple of load calls here. I'll send a pull-request for those changes once I've had a bit more of a play around and hopefully figured out this issue

@jeremyolliver
Copy link
Contributor

Managed to work out what looks like a quite small fix to get this working over at: #29 (would have attached the pull request here if I knew how, not sure if that's possible)

@manuelmeurer
Copy link
Contributor

+1 Great!

@swachian
Copy link
Author

Can you tell me how to install the new update?

@manuelmeurer
Copy link
Contributor

@swachian, The easiest way is to wait for @ctran to pull in that change into the main repository and release a new version. If you don't want to wait, add the following to your Gemfile:

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

@jeremyolliver
Copy link
Contributor

I'm doing exactly what manuel says, specifying via a git branch, though I'm using 'dependency_compatibility' as the branch, which includes both pull requests I submitted #29 and #30 and once these are released into a new version, I'll be switching back to a standard install.

@jeremyolliver
Copy link
Contributor

@ctran Thanks for getting these merged in :) Looks like this issue, and issue #12 can be closed off now.

@swachian
Copy link
Author

Thanks to all

@corroded
Copy link

i updated my annotate using gem 'annotate', :git => "https://github.com/ctran/annotate_models.git" and it still happens to me. is there any other fix or branch i should get?

@jeremyolliver
Copy link
Contributor

@corroded are you remembering to call the correct executable via bunde exec annotate ? Otherwise the existing install of annotate will be used, not the most up to date one you've installed via git

@corroded
Copy link

oh oh oh. sorry i forgot about that! I should've just uninstalled and installed the gem instead of just doing another bundle install(which probably didn't refresh the installation) thanks for the reminder!

@calvinl
Copy link

calvinl commented Jul 22, 2011

I had this same error. Got it to work by simply adding require 'rake' in my Rakefile.

EDIT: Oh, I guess this was the small fix jeremyolliver was referring to, except it patches annotated.rb specifically.

@m00nh3ck
Copy link

Easy one

@spindola
Copy link

spindola commented Oct 2, 2011

Thanks Jeremy for the fix. I'm currently working my way through Michael Hartl's RonR3 tutorial and this was a big help.

@eeewxj
Copy link

eeewxj commented Oct 5, 2011

As calvinl commented ,it just need a require 'rake' in file Rakefile.
Thanks a lot.

@darkmuse
Copy link

darkmuse commented Oct 6, 2011

annotate-2.4.1.beta1 seems to already be out there.

@svsvenu
Copy link

svsvenu commented Oct 19, 2011

What does require 'rake' do? to the process?

@chezca1228
Copy link

great.. this saves me :)

@wlaurance
Copy link

Thanks it worked for me!

@plagi
Copy link

plagi commented Dec 2, 2011

Thanks!

@albertovilla
Copy link

Great. This solved the issue. Thanks a lot.

@dankozlowski
Copy link

Awesome, thank you!

@jonleung
Copy link

@wxjaqy suggestion worked for me!

@jalvarezsamayoa
Copy link

Confirmed.

Addding require 'rake' in RakeFile solved the problem.

ruby 1.9.2-p318
rails 3.2.3
annotate 2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests