実現したいこと
・投稿機能作成
前提
ruby on railsで画像投稿サイトを作成しています。
投稿機能を作成しているときに以下のエラーが出ました。
newアクションを表示させたいです。
発生している問題・エラーメッセージ
Routing Error
エラーメッセージ
uninitialized constant PostImagesController Object.const_get(camel_cased_word) ^^^^^^^^^^ Did you mean? PostlmagesController raise MissingController.new(error.message, error.name) ^^^^^
該当のソースコード
class PostlmagesController < ApplicationController
def new
@post_image = PostImage.new
end
def create
@post_image = PostImage.new(post_image_params)
@post_image.user_id = current_user.id
@post_image.save
redirect_to post_images_path
end
def index
@post_images = PostImage.all
end
def show
@post_image = PostImage.find(params[:id])
end
# 投稿データのストロングパラメータ
private
def post_image_params
params.require(:post_image).permit(:shop_name, :image, :caption)
end
end
_______________________________
app>views>layouts>postimages>new.html.erb
________________________________
Rails.application.routes.draw do
root 'homes#top'
devise_for :users
resources :post_images, only: [:new, :create, :index, :show]
end
試したこと
view, controllerでクラス名や誤字がないか確認。routes statusでpost_imagesのルートが作れているか確認したが解決しなかった。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してくださ

回答1件
あなたの回答
tips
プレビュー