teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

誤字の修正

2019/02/12 04:35

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  def create
19
19
  @album = current_user.albums.find_by(params[:id])
20
- @picture = @album.posts.build(picture_params)
20
+ @picture = @album.pictures.build(picture_params)
21
21
  if @picture.save
22
22
  flash[:success] = "写真を追加しました!"
23
23
  redirect_to @album

1

誤字の修正

2019/02/12 04:35

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -17,8 +17,8 @@
17
17
 
18
18
  def create
19
19
  @album = current_user.albums.find_by(params[:id])
20
- @post = @album.posts.build(post_params)
20
+ @picture = @album.posts.build(picture_params)
21
- if @post.save
21
+ if @picture.save
22
22
  flash[:success] = "写真を追加しました!"
23
23
  redirect_to @album
24
24
  else
@@ -28,8 +28,8 @@
28
28
 
29
29
  private
30
30
 
31
- def post_params
31
+ def picture_params
32
- params.fetch(:post, {}).permit(:picture)
32
+ params.fetch(:picture, {}).permit(:picture)
33
33
  end
34
34
 
35
35
  end