我正在升级到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如下。
即使你不知道答案,如果你对我在这里如何处理调试过程有任何建议,那就太棒了。
-Jeff
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
答案 0 :(得分:1)
当我做以下事情时,我遇到了类似的问题:
api_client = API::Client
api_model = 'task' #this is dynamic in reality...
api_client.send(api_model).list
Rake的Global DSL 任务方法由于某种原因破坏了发送,但如果我直接调用它(不使用send),则调用有效。最后我只是将动态调用改为小牛肉。
eval "api_client.#{api_model}.list"
速度较慢但是当他们最终从Rake中移除Global DSL时我会改回来。
HTH,YMMV; - )