vue.js周り
rails周り
NameError - uninitialized constant Object::Something
モデルの名前を単数形にしていないときに出たエラー
Your Yarn packages are out of date!
========================================
Your Yarn packages are out of date!
Please run `yarn install` to update.
========================================
To disable this check, please add `config.webpacker.check_yarn_integrity = false`
to your Rails development config file (config/environments/development.rb).
yarn check v1.3.2
error Lockfile does not contain pattern: "firebase@^4.8.1"
error Lockfile does not contain pattern: "vuefire@^1.4.5"
error Found 2 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
- webpack
- vue.js
- yarn
この構成で開発していたら上記のエラーが出た。意味はyarnの中のパッケージに古いものがあるとのこと。
yarn install
でパッケージをインストールして
https://github.com/rails/webpacker/blob/master/README.md
ここにあるようにconfig/environment/development.rbに下記追加で解決
config.webpacker.check_yarn_integrity = false
You are using the runtime-only build of Vue where the template compiler is not available.
vue.runtime.esm.js:574 [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
(found in <Root>)
https://qiita.com/you88/items/62e0314243841dd08ccf
ここにまとめているように完全ビルドにしてねというエラー。
import Vue from 'vue/dist/vue.esm';
を冒頭に入れて解決。
ActiveModel::UnknownAttributeError (unknown attribute 'sns_id' for Post.):
sns_idというattributeが不明というもの。このケースではrails db:migrateがうまくいってなくてカラムが追加できていなくてactive recordにsns_idが追記されていなかったのが原因だった。rails db:migrateをやり直したら直った。