2017-12-29 32 views

답변

1

gemfile에 pg 보석을 추가하십시오. 당신이없는 경우

# Use postgresql as the database for Active Record 
gem 'pg' 

그런 다음, 당신은 그래서 fole를 만들 가서 config 디렉토리에 config 디렉토리에 database.yml 파일이 필요합니다 다음과 같아야합니다 database.yml라는 것입니다.

설정/database.yml을

default: &default 
adapter: postgresql 
encoding: unicode 
username: your username for your Postgresql access 
password: your password for your Postgresql access 
# For details on connection pooling, see rails configuration guide 
# http://guides.rubyonrails.org/configuring.html#database-pooling 
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 

development: 
    <<: *default 
    database: The name for your **development** database that you created (probably in PGAdmin?) 

test: 
    <<: *default 
    database: The name for your **test** database that you created (probably in PGAdmin?) 

production: 
    <<: *default 
    database: The name for your **production** database that you created (probably in PGAdmin?) 
+2

하나는 아마도/application.rb을 config (설정) 할 active_record 라인을 추가해야합니다. 구성 테스트 생성기, 아마도. 그리고 신은 또 무엇을 압니다. 새로운 앱이라면 재생성하기 쉽습니다. –

+1

만약 내가 옵션이 –

+0

록웰과 세르지오 감사합니다, 나는이 옵션 (프로젝트를 다시 시작)을 고려하지만, 또한 자신을 DB를 추가하고 일을 만들려고 노력 도전 하겠어, 그냥 재건에 동의, 아마 재미있는 것을 배울 것입니다! – romss182