对于#<createcorrespondentloans

时间:2015-09-01 06:43:44

标签: ruby-on-rails rails-migrations

=“”

我正在使用rails 4&amp; ruby 2.0.0。

当我点击rake db:migrate时我得到了错误。它指向add_index行有问题。

 ==  CreateCorrespondentLoans: migrating ======================================
-- create_table(:correspondent_loans)
-> 0.0036s
-- correspondent_loans()
rake aborted!
 StandardError: An error has occurred, this and all later migrations canceled:

 undefined local variable or method `correspondent_loans' for #<CreateCorrespondentLoans:

这是代码

    class CreateCorrespondentLoans < ActiveRecord::Migration
 def change
 create_table :correspondent_loans do |t|
  t.string :correspondent
  t.date :purchase_date
  t.decimal :loan_amount, precision: 15, scale: 2
  t.string :curr_status
  t.string :instrument_name
  t.string :loan_id, null: false

  t.timestamps
end

add_index correspondent_loans, loan_id, name: "index_correspondent_loans_loan_id", unique: true, using: :btree
  end
end

1 个答案:

答案 0 :(得分:1)

struct hsvoutput

Correspondent_loans和load_id应该是一个符号。