4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby on Rails  良くあるエラー(随時追記)

Last updated at Posted at 2019-07-31

gemに追記した後、bundle installをしないと発生する

対処方法:
railsのサーバを再起動すれば良い。
スクリーンショット 2019-07-31 14.14.55.png

Routing Errorが起こった時

対処方法:
要はマッチするルーティングがないと言っているのでroutes.rbを確認する。
次にviewに記述したルートが正しく記述されているか確認する。
スクリーンショット 2019-07-31 15.00.43.png

 SassC::SyntaxError in List#new  4章−1 Trello風ToDoタスク管理アプリを作成しよう!【Rails】で出現したエラー

application.scssに@imoprot "list/new"を追加して、/list/newにアクセスすると以下のようなエラーが出現。railsのサーバを再起動しても、ダメだった。よくよく見るとListフォルダの中にnew.scssをいれていないだけだった^^;
スクリーンショット 2019-08-01 15.33.20.png

引数の数が間違っている時におこるエラー

今回の場合 users_controller.rbdef update(user_params)という引数がおかしかったため発生した。
スクリーンショット 2019-08-12 19.33.22.png

controllerの最初の記述が間違っていたので発生したエラー

class ItemController < ApplicationControllerと書いてしまい発生した。正しいのは class ItemsController < ApplicationController
スクリーンショット 2019-08-15 18.07.05.png

controller.rbのclassの定義のところで末尾に全角のスペースが入っていた。

参考にした記事 uninitialized constant ~~Controllerについて
スクリーンショット 2019-08-15 18.54.56.png

rake db:migrateができていない時に発生する

自分の場合はmigrationファイルにカラムを追加したが、そこに誤字があったためうまくmigrateできていなかった。

スクリーンショット 2019-08-16 16.43.50.png

activeadmin のgemをインストールして rails generate active_admin:install を実行したところ起こったエラー。エラーとしては The asset "active_admin.css" is not present in the asset pipeline.となっており、アセットパイプラインにactive_admin.cssがないですよという状態になっている。

解決方法はactive_adminの公式サイト参考に rails generate active_admin:asset を実行。active_admin公式サイト
スクリーンショット 2019-08-16 16.55.25.png

4
5
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
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?