guptron guptron - 2 years ago 84
Ruby Question

When trying to generate a model with Rails and PostgreSQL, the command hangs without error

When using this command:

rails generate model Event name:string

Nothing happens, and I have to CTRL+c.

The versions I'm using are:

  • Ruby 2.1.1p76

  • Rails 4.1.0

  • PostgreSQL 9.3.4

  • Mac OS X 10.9.3

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

When running
rake db:create
, I get the following message:

easyEventTracker_development already exists

easyEventTracker_test already exists

Contents of the database.yml file:

default: &default
adapter: postgresql
encoding: unicode
pool: 5

<<: *default
database: easyEventTracker_development

<<: *default
database: easyEventTracker_test

<<: *default
database: easyEventTracker_production
username: easyEventTracker

If I setup the project using Rails with SQLite, everything works fine.

Answer Source

There is a bug in Spring with Rails 4.1 which causes generators to hang.

Try running spring stop and running the generator again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download