guptron guptron - 7 months ago 33
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

development:
<<: *default
database: easyEventTracker_development

test:
<<: *default
database: easyEventTracker_test

production:
<<: *default
database: easyEventTracker_production
username: easyEventTracker
password: <%= ENV['EASYEVENTTRACKER_DATABASE_PASSWORD'] %>


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

Answer

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

Try running spring stop and running the generator again.

Comments