簡體   English   中英

耙中止錯誤的參數數量

[英]rake aborted wrong number of arguments

運行遷移時出現以下錯誤。

我正在使用ruby 1.8.6版本。 我們已經開發了插件,以使紅寶石代碼與Teradata兼容。 此遷移與在后端創建Teradata表有關。

我的遷移文件:

    class CreateObbPacDetails < ActiveRecord::Migration
  def self.up
    down
    DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.create_table
  end

  def self.down
    DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.drop_table
  end
end

我的模特:

class DataWarehouse::PromotionsTradeData::ObbPacDetails < DataWarehouse::Table::Base
  has_nickname :obb_pac_details
  is_permanent_table

  has_fields :forecast_date       => "date format 'yyyy-mm-dd'",
             :areacode            => "byteint not null",
             :bpr_regn            => "char(2) not null",
             :base_product_number => "integer not null",
             :offer_start_date    => "date format 'yyyy-mm-dd' not null",
             :offer_id            => "char(9) not null",
             :offer_end_date      => "date format 'yyyy-mm-dd' not null",
             :bpr_uplift_perc     => "byteint not null"

  has_primary_key [:areacode, :bpr_regn, :base_product_number, :offer_start_date]

  collect_stats_on :areacode
  collect_stats_on :bpr_regn
  collect_stats_on :base_product_number
  collect_stats_on :offer_start_date  
  collect_stats_on [:forecast_date, :base_product_number]

錯誤代碼:

rake db:migrate VERSION=20140328000102 --trace
(in /data/bpf/rails_dev/RB-5.2-exp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
wrong number of arguments (1 for 2)
/data/bpf/rails_dev/RB-5.2-exp/app/models/data_warehouse/promotions_trade_data/obb_pac_details.rb:29:in `has_insert_statement'
/data/bpf/rails_dev/RB-5.2-exp/app/models/data_warehouse/promotions_trade_data/obb_pac_details.rb:29
/appl/apache/dev/development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/appl/apache/dev/development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:81:in `require_all'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:79:in `each'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:79:in `require_all'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:121:in `require_rel'

在遷移中,您沒有在DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.create_table之后為遷移提供表名。

據我所知, create_table希望表名是必需的參數。

另外,我假設def self.updown是一個錯字。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM