如何在ROR-4中解决standradError

时间:2014-12-20 05:42:08

标签: ruby-on-rails ruby ruby-on-rails-4 paperclip

任何团体都可以找到此错误的解决方案吗?我正在关注此Link并打开一个app.First i typed命令 “rails生成paperclip用户头像”。当我运行命令rake db:migrate时,它给出了这个错误。

错误:

StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "avatar_fil
e_name" varchar(255)c:/Site/attachment1/db/migrate/20141220045244_add_attachment
_avatar_to_users.rb:4:in `block in up'
c:/Site/attachment1/db/migrate/20141220045244_add_attachment_avatar_to_users.rb:
3:in `up'
C:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我的20141220045244_add_attachment_avatar_to_users.rb文件包含

class AddAttachmentAvatarToUsers < ActiveRecord::Migration
  def self.up
    change_table :users do |t|
      t.attachment :avatar
    end
  end

  def self.down
    remove_attachment :users, :avatar
  end
end

请帮助解决此错误。

1 个答案:

答案 0 :(得分:0)

您的问题是没有用户&#39;表。 SQLite3 :: SQLException:没有这样的表:users