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

前端 未结 3 1624
迷失自我
迷失自我 2021-02-07 12:17

When using this command:

rails generate model Event name:string

Nothing happens, and I have to CTRL+c.

The versions I\'m using are:

相关标签:
3条回答
  • 2021-02-07 13:04

    It appears you are not providing username and password for your development and test databases. You should verify you are able to connect to your database using

    rails dbconsole
    

    which will provide a database specific SQL-prompt that uses the credentials you provide in database.yml. While sqlite3 is a file based program which does not need login credentials you will need them even for development mode if you use a database that is able to use different schema.

    If you set up your development schema to work without a password you will still need to provide the schema name as username as in

    username: easyEventTracker_development
    
    0 讨论(0)
  • 2021-02-07 13:10

    Same thing happened to me and I wasn't using Spring so the solution didn't work.

    I just quit the console, opened it up again, ran the same command and it worked.

    0 讨论(0)
  • 2021-02-07 13:22

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

    Try running spring stop and running the generator again.

    0 讨论(0)
提交回复
热议问题