Ruby on rails Rails和设计为注册页面提供错误

Ruby on rails Rails和设计为注册页面提供错误,ruby-on-rails,ruby,devise,Ruby On Rails,Ruby,Devise,我已经在谷歌上搜索了这个问题的答案,所以即使这个问题和其他已经提出的问题相似,请知道我已经尝试了这里发布的所有答案 我一直在遵循一个教程来建立一个Rails站点,与用户一起等等。我正处于尝试使用Desive生成用户数据库的阶段 当我尝试访问注册页面时,出现以下错误: ActiveRecord::StatementInvalid in Devise::RegistrationsController#new 我发现的建议是使用rakedb:migrate来修复数据库 这给了我以下错误: SQLit

我已经在谷歌上搜索了这个问题的答案,所以即使这个问题和其他已经提出的问题相似,请知道我已经尝试了这里发布的所有答案

我一直在遵循一个教程来建立一个Rails站点,与用户一起等等。我正处于尝试使用Desive生成用户数据库的阶段

当我尝试访问注册页面时,出现以下错误:

ActiveRecord::StatementInvalid in Devise::RegistrationsController#new
我发现的建议是使用
rakedb:migrate
来修复数据库

这给了我以下错误:

SQLite3::SQLException: duplicate column name: email: ALTER TABLE "installs" ADD "email" varchar(255) DEFAULT '' NOT NULL/ruby/testapp/omrails/db/migrate/20130510151217_add_devise_to_installs.rb:5:in `block in up'
/ruby/testapp/omrails/db/migrate/20130510151217_add_devise_to_installs.rb:3:in `up'
/Users/BWS/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/Users/BWS/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate
再说一遍

[可能相关] 当我使用rails做任何事情时,我也会收到以下消息:

/Users/BWS/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

看起来您有两次迁移,都在
安装中添加了电子邮件字段。您必须查看所有迁移文件,看看这是否属实。有三种方法可以将电子邮件字段添加到表中,因此请查找以下方法之一:

#1
create_table "installs" do |t|
  t.string :email

#2
change_table "installs" do |t|
  t.string :email

#3
add_column :installs, :email, :string

有些版本的Desive创建迁移时没有.rb扩展名。当我遇到与您相同的错误时,我导航回“migrate”文件夹,果然生成的迁移缺少扩展名。添加.rb,然后运行$rakedb:migrate为我解决了这个问题

您使用什么版本的rails?另外,您应该重新安装ruby,以删除YAML警告…我刚刚重新安装。rails的版本是3.2.13,Ruby的版本是1.9.3。我刚刚重新安装,YAML警告仍然有效:/you尝试安装LibyML了吗?如果您使用brew,您可以执行
brew安装libyaml
brew安装libyaml导致警告:libyaml-0.1.4已经安装,它只是没有链接我如何链接?好的,所以我卸载并重新安装了,仍然会出现错误:缺少psych(用于YAML输出)和未链接错误。我重新安装了rails,删除了所有迁移,现在只有一次迁移(再次运行'sudo rails generate designe'User之后),但我仍然在designe::RegistrationController#new中得到ActiveRecord::StatementInvalid,并且在我转到注册页面时找不到表'users'错误。我遗漏了什么吗?您是否记得删除/删除数据库,并在删除和重新创建所有迁移后运行
rake db:migrate
?这导致:SQLite3::SQLException:没有这样的表:users。很抱歉让人沮丧,我不明白为什么什么都不起作用。您应该结帐以了解有关迁移的更多信息。迁移会对数据库进行更改,如创建表、更改列等。您应该为创建相应表的每个模型进行迁移。Desive拥有一个生成器,为Desive用户创建正确的迁移。如果您在
users
上使用designe,那么您应该运行
rails generate designe User
,然后
rake db:migrate
尝试在此处发布您的
schema.rb
文件。否则,加入这个房间,我可以帮你:)在看到这个错误后对我有效:ActiveRecord::StatementInvalid in Devage::RegistrationsController#new
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do

end
#1
create_table "installs" do |t|
  t.string :email

#2
change_table "installs" do |t|
  t.string :email

#3
add_column :installs, :email, :string