2014-12-20 26 views
0

任何人都可以找出解決這個錯誤的方法嗎?我正在關注這個Link和tring來製作一個應用程序。首先我輸入命令 「rails generate paperclip user avatar」。命令rake db:migrate,它給了這個錯誤。如何解決ROR-4中的standradError

錯誤:

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 

請幫助解決這個錯誤。

+0

'沒有這樣的表格:用戶' –

+1

您的應用程序是否有用戶模型/表格? – tagCincy

+0

加載rake db:schema:load更正了問題。 – djrock

回答

0

你的問題是沒有'用戶'表。 SQLite3 :: SQLException:沒有這樣的表格:用戶