#環境
Windows10 Home
Ruby 2.5.3
Rails 5.2.3
SQLite 3.27.2
#内容
Railsを入門しようとしている者です。
技術評論社の『Ruby on Rails5 アプリケーションプログラミング』という書籍でRailsの勉強をしている際、フィクスチャでテストデータのymlファイルをデータ投入?しようとし、
$ rails db:fixtures:load FIXTURES=books
とコマンドを打つと以下のようなエラーがでました
rails aborted! ActiveRecord::Fixture::FormatError: a YAML error occurred parsing C:/Users/~~/Documents/railbook/test/fixtures/books.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html The exact error was: Psych::SyntaxError: (<unknown>): invalid leading UTF-8 octet at line 1 column 1 bin/rails:4:in `require' bin/rails:4:in `<main>' Caused by: Psych::SyntaxError: (<unknown>): invalid leading UTF-8 octet at line 1 column 1 bin/rails:4:in `require' bin/rails:4:in `<main>' Tasks: TOP => db:fixtures:load (See full trace by running task with --trace)
まだ入門者なのでこのエラーの内容が分からず、自分なりに調べた結果UTF-8?のフォーマットのエラーなどと出たのですが結局解決方法は分からず...。
ymlファイル自体は読んでいる入門書が配布していたものです。
そのymlファイルの中身(一部省略)は以下の通りです。
yml
1# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html 2 3modernjs: 4 id: 1 5 isbn: 978-4-7741-8411-1 6 title: 改訂新版JavaScript本格入門 7 price: 2980 8 publish: 技術評論社 9 published: 2016-09-30 10 dl: false
どなたか解決方法を教えて頂けると助かります。
また、補足してほしいものがあればご指摘した頂くと助かります。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。