1

我正在升级到 3.1,但遇到了麻烦。

我有一个模型(使用 Mongoid),显然它的“链接”方法被 Rake 覆盖。我收到这条消息:

WARNING: Global access to Rake DSL methods is deprecated.  Please include
...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Profile#link called at /Users/jeffdeville/Documents/code/ruby/wg/app/models/profile.rb:62:in `block in eql?'

因为该方法正在解析,所以我没有堆栈跟踪或任何东西。这发生在我的 rspecs 中,但问题不会发生在控制台中。

Gemfile 如下。

即使您不知道答案,如果您对我在这里如何处理调试过程有任何建议,那就太好了。

-杰夫

source 'http://rubygems.org'

gem 'rails', "3.1.0"
gem 'rake'
gem 'mail'

gem 'compass', "~> 0.12.alpha.0"
gem 'jquery-rails'
gem 'haml-rails'
gem "html5-boilerplate"

gem 'mini_fb', :git => 'git://github.com/jeffdeville/mini_fb.git'
gem "json"
gem "bson"
gem "bson_ext"
gem 'sucker'
gem 'crack', :git => 'git://github.com/ericgj/crack.git'
gem 'hoptoad_notifier'
gem 'httparty'
gem 'facebooker2'
gem 'delayed_job'
gem 'delayed_job_mongoid'
gem 'unicorn'
gem 'hirefireapp'
gem 'mogli', :git => 'https://github.com/jeffdeville/mogli.git'
gem 'typhoeus'
gem 'koala'
gem 'foreman'
gem 'heroku'
gem 'rbing'
gem 'rmagick'
gem 'mini_magick'
gem 'aws-sdk'
gem 'mechanize'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

group :development, :test do
  gem 'awesome_print'
  gem 'pry'
end

group :development do
  gem 'rails3-generators'
    gem 'coffee-script'
    gem 'guard'
    gem 'guard-coffeescript'
    gem 'guard-livereload'
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'guard-bundler'
  gem 'mailcatcher'
  gem 'foreman'
end

group :test do
    gem "factory_girl_rails"
  gem 'fuubar'
  gem 'spork', '~> 0.9.0.rc'
    gem 'ruby-debug19'
    gem "rspec"
  gem "rspec-given"
    gem "rspec-rails"
  gem 'mocha'
  gem "bourne"
    gem 'webmock'
    gem 'vcr'
    gem 'jasmine'
    gem 'email_spec'
  gem 'timecop'
end

group :mac do
#  if RUBY_PLATFORM =~ /darwin/i
    gem 'rb-fsevent'
    gem 'growl'
#  end
end
4

1 回答 1

1

当我执行以下操作时,我遇到了类似的问题:

api_client = API::Client
api_model = 'task' #this is dynamic in reality...
api_client.send(api_model).list

Rake 的 Global DSL任务方法由于某种原因破坏了发送,但如果我直接调用它(不使用发送),调用就会起作用。最后,我只是将动态调用更改为小牛肉。

eval "api_client.#{api_model}.list"

它速度较慢,但​​当他们最终从 Rake 中删除 Global DSL 时,我会将其改回。

HTH,YMMV ;-)

于 2011-09-22T11:26:29.500 回答