Help us understand the problem. What is going on with this article?

[The action 'アクション名' could not be found for コントローラ名]が出てくるとき

とても下らない理由でエラーが出たので、備忘録と反省的な意味を込めて残しておきます。

Screen Shot 2019-09-26 at 12.11.30.png

ArticlesControllerを見て、createアクションあることを確認したのにも関わらず、こんなエラー(画像はRailsガイドから拝借してきました)が出たので結構な時間ルーティング見たり、色々悩んだ結果、privateメソッドに入ってました。

# 本来こうなっているはず
def index

end

def create

end
# それがこうなってたのでエラー
def index

end

private

def create

end

たくさんメソッドがあってわかりづらくなっていたのもありますが、
インデントを1段深くしてればすぐ気づけたかもです。

結論

privateメソッドはインデントを1段深くしとこう。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away