Ruby on rails 使用twitter gem-rails应用程序在twitter上发布

Ruby on rails 使用twitter gem-rails应用程序在twitter上发布,ruby-on-rails,ruby,windows,twitter,twitter-gem,Ruby On Rails,Ruby,Windows,Twitter,Twitter Gem,我正在使用rails构建一个应用程序,允许用户使用其Twitter帐户授权并连接到Twitter API。登录正常,但我使用的POST有问题:当我尝试运行rails db:migrate时,出现以下错误: $ rails db:migrate rails aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::DuplicateTable: ERROR: relati

我正在使用rails构建一个应用程序,允许用户使用其Twitter帐户授权并连接到Twitter API。登录正常,但我使用的POST有问题:当我尝试运行rails db:migrate时,出现以下错误:

$ rails db:migrate
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "tweets" already exists
: CREATE TABLE "tweets" ("id" serial primary key, "user_id" integer, "body" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
C:/Users/......./db/migrate/20170419185735_create_tweets.rb:3:in `change'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR:  relation "tweets" already exists
: CREATE TABLE "tweets" ("id" serial primary key, "user_id" integer, "body" text, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
C:/Users/......./db/migrate/20170419185735_create_tweets.rb:3:in `change'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
PG::DuplicateTable: ERROR:  relation "tweets" already exists
C:/Users/......./db/migrate/20170419185735_create_tweets.rb:3:in `change'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20170419185735 CreateTweets: migrating =====================================
-- create_table(:tweets)
$rails数据库:迁移
rails中止了!
StandardError:发生错误,此迁移和所有后续迁移已取消:
PG::DuplicateTable:错误:关系“tweets”已存在
:创建表“tweets”(“id”序列主键,“user\u id”整数,“body”文本,“在“timestamp NOT NULL”处创建”,在“timestamp NOT NULL”处更新)
C:/Users/…/db/migrate/20170419185735_create_tweets.rb:3:in'change'
箱子/轨道:4:在'require'中
箱子/轨道:4:in`'
ActiveRecord::语句无效:PG::DuplicateTable:错误:关系“tweets”已存在
:创建表“tweets”(“id”序列主键,“user\u id”整数,“body”文本,“在“timestamp NOT NULL”处创建”,在“timestamp NOT NULL”处更新)
C:/Users/…/db/migrate/20170419185735_create_tweets.rb:3:in'change'
箱子/轨道:4:在'require'中
箱子/轨道:4:in`'
PG::DuplicateTable:错误:关系“tweets”已存在
C:/Users/…/db/migrate/20170419185735_create_tweets.rb:3:in'change'
箱子/轨道:4:在'require'中
箱子/轨道:4:in`'
任务:TOP=>db:migrate
(通过使用--trace运行任务查看完整跟踪)
==20170419185735 CreateTweets:迁移=====================================
--创建_表(:tweets)

我是rails新手,希望您能给予我帮助

看起来您已经有了一个名为
tweets
的表,您的迁移失败了。在使用gem之前,您是否手动创建了它?您可以使用
rakedb:migrate
清理数据库并从头开始重建它吗?我使用了
railsdb:reset
。非常感谢你!现在开始工作了!