尝试使用Rails和PostgreSQL生成模型时,命令挂起没有错误 [英] When trying to generate a model with Rails and PostgreSQL, the command hangs without error

查看:74
本文介绍了尝试使用Rails和PostgreSQL生成模型时,命令挂起没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此命令时:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆