2013-02-12 8 views
1

я получаю следующее сообщение об ошибке при реализации грабли БД: мигрироватьОшибка при реализации на PostgreSQL рубин на рельсах

rake aborted! 
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

Я создал две таблицы в базе данных, используя PostgreSQL.

Мой database.yml является

development: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: shop_development 
    pool: 5 
    username: postgres 
    password: 

test: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: shop_test 
    pool: 5 
    username: postgres 
    password: 

production: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: shop_production 
    pool: 5 
    username: postgres 
    password: 

Я также запустить такую ​​команду:

C:\Sites\shop>gem install 'pg' 
Successfully installed pg-0.14.1-x86-mingw32 
1 gem installed 
Installing ri documentation for pg-0.14.1-x86-mingw32... 
Installing RDoc documentation for pg-0.14.1-x86-mingw32... 

, но это по-прежнему дает мне ту же ошибку.

Мой Gemfile имеет следующее:

GEM 
    remote: https://rubygems.org/ 
    specs: 
    actionmailer (3.2.11) 
     actionpack (= 3.2.11) 
     mail (~> 2.4.4) 
    actionpack (3.2.11) 
     activemodel (= 3.2.11) 
     activesupport (= 3.2.11) 
     builder (~> 3.0.0) 
     erubis (~> 2.7.0) 
     journey (~> 1.0.4) 
     rack (~> 1.4.0) 
     rack-cache (~> 1.2) 
     rack-test (~> 0.6.1) 
     sprockets (~> 2.2.1) 
    activemodel (3.2.11) 
     activesupport (= 3.2.11) 
     builder (~> 3.0.0) 
    activerecord (3.2.11) 
     activemodel (= 3.2.11) 
     activesupport (= 3.2.11) 
     arel (~> 3.0.2) 
     tzinfo (~> 0.3.29) 
    activeresource (3.2.11) 
     activemodel (= 3.2.11) 
     activesupport (= 3.2.11) 
    activesupport (3.2.11) 
     i18n (~> 0.6) 
     multi_json (~> 1.0) 
    arel (3.0.2) 
    builder (3.0.4) 
    coffee-rails (3.2.2) 
     coffee-script (>= 2.2.0) 
     railties (~> 3.2.0) 
    coffee-script (2.2.0) 
     coffee-script-source 
     execjs 
    coffee-script-source (1.4.0) 
    erubis (2.7.0) 
    execjs (1.4.0) 
     multi_json (~> 1.0) 
    hike (1.2.1) 
    i18n (0.6.1) 
    journey (1.0.4) 
    jquery-rails (2.2.1) 
     railties (>= 3.0, < 5.0) 
     thor (>= 0.14, < 2.0) 
    json (1.7.6) 
    mail (2.4.4) 
     i18n (>= 0.4.0) 
     mime-types (~> 1.16) 
     treetop (~> 1.4.8) 
    mime-types (1.21) 
    multi_json (1.5.0) 
    polyglot (0.3.3) 
    rack (1.4.5) 
    rack-cache (1.2) 
     rack (>= 0.4) 
    rack-ssl (1.3.3) 
     rack 
    rack-test (0.6.2) 
     rack (>= 1.0) 
    rails (3.2.11) 
     actionmailer (= 3.2.11) 
     actionpack (= 3.2.11) 
     activerecord (= 3.2.11) 
     activeresource (= 3.2.11) 
     activesupport (= 3.2.11) 
     bundler (~> 1.0) 
     railties (= 3.2.11) 
    railties (3.2.11) 
     actionpack (= 3.2.11) 
     activesupport (= 3.2.11) 
     rack-ssl (~> 1.3.2) 
     rake (>= 0.8.7) 
     rdoc (~> 3.4) 
     thor (>= 0.14.6, < 2.0) 
    rake (10.0.3) 
    rdoc (3.12.1) 
     json (~> 1.4) 
    sass (3.2.5) 
    sass-rails (3.2.6) 
     railties (~> 3.2.0) 
     sass (>= 3.1.10) 
     tilt (~> 1.3) 
    sprockets (2.2.2) 
     hike (~> 1.2) 
     multi_json (~> 1.0) 
     rack (~> 1.0) 
     tilt (~> 1.1, != 1.3.0) 
    sqlite3 (1.3.7-x86-mingw32) 
    thor (0.17.0) 
    tilt (1.3.3) 
    treetop (1.4.12) 
     polyglot 
     polyglot (>= 0.3.1) 
    tzinfo (0.3.35) 
    uglifier (1.3.0) 
     execjs (>= 0.3.0) 
     multi_json (~> 1.0, >= 1.0.2) 

PLATFORMS 
    x86-mingw32 

DEPENDENCIES 
    coffee-rails (~> 3.2.1) 
    jquery-rails 
    rails (= 3.2.11) 
    sass-rails (~> 3.2.3) 
    sqlite3 
    uglifier (>= 1.0.3) 

Мой Gemfile имеет следующее содержание: -

source 'https://rubygems.org' 

gem 'rails', '3.2.11' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

# gem 'sqlite3' 

gem 'pg' 


# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'debugger' 

мой пакет установки показывают следующее: -

C:\Sites\shop>bundle install 
Using rake (10.0.3) 
Using i18n (0.6.1) 
Using multi_json (1.5.0) 
Using activesupport (3.2.11) 
Using builder (3.0.4) 
Using activemodel (3.2.11) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.2.2) 
Using actionpack (3.2.11) 
Using mime-types (1.21) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.4.4) 
Using actionmailer (3.2.11) 
Using arel (3.0.2) 
Using tzinfo (0.3.35) 
Using activerecord (3.2.11) 
Using activeresource (3.2.11) 
Using bundler (1.0.22) 
Using coffee-script-source (1.4.0) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.3) 
Using json (1.7.6) 
Using rdoc (3.12.1) 
Using thor (0.17.0) 
Using railties (3.2.11) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.2.1) 
Using pg (0.14.1) 
Using rails (3.2.11) 
Using sass (3.2.5) 
Using sass-rails (3.2.6) 
Using uglifier (1.3.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem 
is installed. 
+1

Вы можете добавить свой Gemfile к вопросу? – jvnill

+0

@jvnill Я отредактировал вопрос. Скажите, пожалуйста, помогите мне –

+0

это Gemfile.lock. Gemfile чище, поэтому вы можете использовать это вместо этого? – jvnill

ответ

0

Пожалуйста, попробуйте с этим ..

sudo apt-get install postgresql postgresql-client postgresql-contriblibpq-dev 
+0

@ vijikumar спасибо сейчас, это работает.can u, пожалуйста, расскажите мне, как запустить консоль postgresql в рубине на rail.ie можете указать команду –

+0

поблагодарить вас за помощь мне –

+0

, если это полезно, пожалуйста, отдайте upvote. . – vijikumar

0

Столкнулись bundle install?
Похоже, sqlite3 установлен, но pg нет.

Если вы перемещаете данные из sqlite3 в pg затем посмотреть на эту railscast: Migrating to PostgreSQL

+0

да я уже установил пакет C: \ Sites \ shop> bundle install ... Ваш комплект завершен! Используйте 'bundle show [gemname]', чтобы узнать, где установлен комплект связанного драгоценного камня . –

+0

Как запустить консоль postgresql из командной строки ruby ​​on rails –

+0

Я могу увидеть драгоценный камень в вашем Gemfile, но не в списке установленных камней, которые вы разместили. –

Смежные вопросы