LoginSignup
4
3

More than 5 years have passed since last update.

rails g scaffoldで“could not find expected ':' ”のエラー対処

Last updated at Posted at 2013-08-06

scaffoldジェネレーター実行でエラー

#scaffoldジェネレーター実行

$ rails g scaffold item name:string price:integer description:text
      invoke  active_record
/home/vagrant/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 18 column 3 (Psych::SyntaxError)

原因

database.ymlの定義内で、コロン(:)の後ろにスペースがなかったのが原因。usernameやpasswordなどユーザーが各自変更した部分が疑わしい。

database.yml
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: sample_development
  pool: 5
  username: railsuser
  password: railspass
  host: localhost
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3