NoMethodError:未定义方法`get'for#<class:0xa3b9e1c> rails rake task

时间:2015-05-12 08:25:38

标签: ruby-on-rails ruby ruby-on-rails-3 rake rake-task

我在运行rake任务时遇到此错误。耙子之前用来正常运行。

rake aborted!
NoMethodError: undefined method `get' for #<Class:0xa3b9e1c>
/home/munam/.rvm/gems/ruby-2.1.4/gems/activerecord-    
4.1.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/home/munam/projects/ror/tftus/api/lib/data_providers/data_provider.rb:3:in `initialize'
/home/munam/projects/ror/tftus/api/lib/tasks/data_providers.rake:33:in `new'
/home/munam/projects/ror/tftus/api/lib/tasks/data_providers.rake:33:in `block (2 levels) in <top (required)>'
/home/munam/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `eval'
/home/munam/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => player:create
(See full trace by running task with --trace)

我的佣金任务:

require 'data_providers/providers'

# Affiliation Rake
namespace :affiliation do
  desc "Create Affiliations"
  task :create => :environment do
    AffiliationDataProvider.new.create
  end

  desc "Update Affiliations"
  task :update => :environment do
    AffiliationDataProvider.new.update
 end
end

同样,在同一个文件中还有其他rake任务,它们之前成功运行但现在不成功。

这是我用跟踪

获得的
    ** Invoke affiliation:update (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Execute affiliation:update
    rake aborted!
    NoMethodError: undefined method `get' for #<Class:0xa6aae3c>
    /home/munam/.rvm/gems/ruby-2.1.4/gems/activerecord-4.1.6/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
    /home/munam/projects/ror/tftus/dynastyowner-api/lib/data_providers/affiliation.rb:19:in `update'
    /home/munam/projects/ror/tftus/dynastyowner-api/lib/tasks/data_providers.rake:12:in `block (2 levels) in <top (required)>'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
    /home/munam/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
    /home/munam/.rvm/gems/ruby-2.1.4/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
    /home/munam/.rvm/gems/ruby-2.1.4/bin/rake:23:in `load'
    /home/munam/.rvm/gems/ruby-2.1.4/bin/rake:23:in `<main>'
    /home/munam/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `eval'
    /home/munam/.rvm/gems/ruby-2.1.4/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => affiliation:update

0 个答案:

没有答案