0
我遇到了一個問題。我最近在github上克隆了一個應用程序,並嘗試使用Rails控制檯啓動它。當我輸入其中一個表的名字時,我收到了這條消息。Rails控制檯:項目(表不存在?) - Sqlite3
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'
我不不知道爲什麼它找不到一張桌子。
我假設你在嘗試啓動任何東西之前運行了基本的rake命令? – MCBama
我剛剛嘗試過,併爲# /Users/richardhamilton/MyProjects/fulcrum/db/migrate/20110210082458_devise_create_users.rb:4:in'block in up'獲得了未定義的方法'database_authenticatable' –
什麼是你嘗試的「那個」?耙db:創建? rake db:schema:load?哪一個?或兩者? – MCBama