我遇到了问题。我最近在github上克隆了一个应用程序,并尝试使用Rails控制台启动它。当我输入其中一个表的名称时,我收到了这条消息。
Project
=> Project(Table doesn't exist)
这是Schema.rb文件
ActiveRecord::Schema.define(version: 20120504152649) do
create_table "projects", force: true do |t|
t.string "name"
t.string "point_scale", default: "fibonacci"
t.date "start_date"
t.integer "iteration_start_day", default: 1
t.integer "iteration_length", default: 1
t.datetime "created_at"
t.datetime "updated_at"
t.integer "default_velocity", default: 10
end
create_table "projects_users", id: false, force: true do |t|
t.integer "project_id"
t.integer "user_id"
end
end
这是项目迁移
class CreateProjects < ActiveRecord::Migration
def self.up
create_table :projects do |t|
t.string :name
t.string :point_scale, :default => 'fibonacci'
t.date :start_date
t.integer :iteration_start_day, :default => 1
t.integer :iteration_length, :default => 1
t.timestamps
end
end
def self.down
drop_table :projects
end
end
Gemfile
source 'http://rubygems.org'
ruby '2.1.0'
gem 'rails', '4.0.2'
gem 'sass-rails', '~> 4.0.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.1'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem 'ejs'
gem "compass-rails", "~> 1.1.2"
gem "devise", "~> 3.2.0"
gem 'transitions', '0.1.9', :require => ["transitions", "active_record/transitions"]
gem 'rails-i18n'
gem 'configuration'
gem 'rails-observers', '~> 0.1.2'
# gem 'protected_attributes'
gem 'jquery-ui-rails'
group :production do
gem 'pg'
# This helps with serving assets and log files on the heroku platform.
# See https://github.com/heroku/rails_12factor
# https://devcenter.heroku.com/articles/rails4#logging-and-assets
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'jasmine', '~> 1.3.2'
gem 'capybara'
gem 'database_cleaner'
end
这是我的database.yml文件
# SQLite
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
我已尝试迁移数据库
rake db:migrate
=>undefined method `database_authenticatable' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007fd7832ed418>/Users/richardhamilton/MyProjects/fulcrum/db/migrate/20110210082458_devise_create_users.rb:4:in `block in up'
我尝试过创建数据库
rake db:create
db/development.sqlite3 already exists
我已尝试加载架构
rake db:schema::load
rake aborted!
Don't know how to build task 'db:schema::load'
我不知道为什么找不到桌子。
答案 0 :(得分:2)
运行rake db:drop db:create db:schema:load
,您应该启动并运行。