【发布时间】:2015-05-07 00:07:07
【问题描述】:
我是 Rails 和 Ruby 的新手,我正在尝试让现有项目在我的环境中运行,我正在使用 Ubuntu 14.04 和 Rubymine、Rails 4.2 和 Ruby 2.2.0
这是迁移文件:
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :pid, limit: 20, null: false
t.string :firstname, limit: 40, null: false
t.string :lastname, limit: 40, null: false
t.integer :age
t.string :gender, limit: 4, null: false
t.datetime :birthday
t.string :country, limit: 2
t.timestamps null: false
end
add_index :people, :firstname
add_index :people, :lastname
add_index :people, :country
add_index :people, :pid, unique: true
end
end
我的数据库.yml:
config=/opt/local/lib/postgresql84/bin/pg_config
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: vasco_annuaire
<<: *default
database: annuaire_test
<<: *default
database: annuaire_production
username: annuaire
password: <%= ENV['ANNUAIRE_DATABASE_PASSWORD'] %>
运行 rake db:create 给我
“角色ferenan不存在”
启动 localhost:3000 给
ActiveRecord::NoDatabaseError FATAL: 角色“ferenan”不存在
提取的源代码(在 #661 行附近):659 660 661 662 663 664
rescue ::PG::Error => error if error.message.include?("does not exist") raise ActiveRecord::NoDatabaseError.new(error.message, error) else raise end
我也无法通过 Pg-Admin-III 连接到 Postgresql
server name : Postgresql
host : localhost
port : 5432
maintenance_db : postgres
username : postgres
no password
使用这些参数我得到消息:
fe_sendauth : 没有提供密码
我已将此行添加到我的 pg_hba.conf 中:
host sa all 192.168.0.nnn/32 trust
还有这个到我的 postgresql.conf:
listen_addresses = '*'
然后运行以下命令:
sudo /etc/init.d/postgresql reload
我不知道该做什么以及如何使这些事情协同工作,但正如我的上级之前向我展示的那样,该项目确实有效,不幸的是他目前无法帮助我解决这个问题。任何帮助将不胜感激。
【问题讨论】:
标签: ruby-on-rails ruby postgresql rake rubymine