Does it work with rails 3.1rc?
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'
Same problem here with Ruby 1.9.2 and Rails 3.1.0.rc4
/Users/manuel/.rvm/gems/[email protected]/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/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
from /Users/manuel/.rvm/gems/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `block in load'
from /Users/manuel/.rvm/gems/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/manuel/.rvm/gems/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in'
from /Users/manuel/.rvm/gems/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/manuel/.rvm/gems/[email protected]/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load'
from /Users/manuel/.rvm/gems/[email protected]/gems/activerecord-3.1.0.rc4/lib/active_record/railtie.rb:26:in `block in <class:Railtie>'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `call'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `block in load_tasks'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `each'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/railtie.rb:182:in `load_tasks'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in `block in load_tasks'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in `each'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/application/railties.rb:8:in `all'
from /Users/manuel/.rvm/gems/[email protected]/gems/railties-3.1.0.rc4/lib/rails/application.rb:103:in `load_tasks'
from /Users/manuel/.rvm/gems/[email protected]/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/[email protected]/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
from /Users/manuel/.rvm/gems/[email protected]/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
from /Users/manuel/.rvm/gems/[email protected]/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
from /Users/manuel/.rvm/gems/[email protected]/bin/annotate:19:in `load'
from /Users/manuel/.rvm/gems/[email protected]/bin/annotate:19:in `<main>'
Anyone care to patch?
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?
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
Didn't work for me. I tried inserting include Rake::DSL in different places to no avail...
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
Managed to work out what looks like a quite small fix to get this working over at: https://github.com/ctran/annotate_models/pull/29 (would have attached the pull request here if I knew how, not sure if that's possible)
+1 Great!
Can you tell me how to install the new update?
@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'
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.
@ctran Thanks for getting these merged in :) Looks like this issue, and issue #12 can be closed off now.
Thanks to all
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?
@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
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!
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.
Easy one
Thanks Jeremy for the fix. I'm currently working my way through Michael Hartl's RonR3 tutorial and this was a big help.
As calvinl commented ,it just need a require 'rake' in file Rakefile. Thanks a lot.