尝试使用Rails和PostgreSQL生成模型时,命令挂起没有错误 [英] When trying to generate a model with Rails and PostgreSQL, the command hangs without error
问题描述
使用此命令时:
rails generate model Event name:string
什么也没发生,我必须按CTRL + c.
Nothing happens, and I have to CTRL+c.
我使用的版本是:
- Ruby 2.1.1p76
- Rails 4.1.0
- PostgreSQL 9.3.4
- Mac OS X 10.9.3
我已验证Postgres是否可以正常工作,并且可以通过运行psql easyEventTracker_development
来连接到它.我通过运行rails new easyEventTracker -d postgresql
I've verified that Postgres is working and I can connect to it by running psql easyEventTracker_development
. I setup my rails project by running rails new easyEventTracker -d postgresql
运行rake db:create
时,出现以下消息:
When running rake db:create
, I get the following message:
easyEventTracker_development已经存在
easyEventTracker_test已经存在
easyEventTracker_development already exists
easyEventTracker_test already exists
database.yml文件的内容:
Contents of the database.yml file:
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: easyEventTracker_development
test:
<<: *default
database: easyEventTracker_test
production:
<<: *default
database: easyEventTracker_production
username: easyEventTracker
password: <%= ENV['EASYEVENTTRACKER_DATABASE_PASSWORD'] %>
如果我使用带有SQLite的Rails设置项目,一切正常.
If I setup the project using Rails with SQLite, everything works fine.
推荐答案
Spring在Rails 4.1中存在一个错误,该错误会导致生成器挂起.
There is a bug in Spring with Rails 4.1 which causes generators to hang.
尝试运行spring stop
并再次运行发电机.
Try running spring stop
and running the generator again.
这篇关于尝试使用Rails和PostgreSQL生成模型时,命令挂起没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!