質問編集履歴

5

文法の修正

2021/03/07 23:19

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -34,19 +34,19 @@
34
34
 
35
35
  def index
36
36
 
37
- @posts = Posts.all
37
+ @post = Post.all
38
38
 
39
39
  end
40
40
 
41
41
  def new
42
42
 
43
- @posts = Posts.new
43
+ @post = Post.new
44
44
 
45
45
  end
46
46
 
47
47
  def create
48
48
 
49
- @posts = Posts.new(posts_params)
49
+ @post = Post.new(posts_params)
50
50
 
51
51
  if @post.save
52
52
 
@@ -64,7 +64,7 @@
64
64
 
65
65
  def posts_params
66
66
 
67
- params.require(:posts).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
67
+ params.require(:post).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
68
68
 
69
69
  end
70
70
 

4

postsに修正

2021/03/07 23:19

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -64,7 +64,7 @@
64
64
 
65
65
  def posts_params
66
66
 
67
- params.require(:post).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
67
+ params.require(:posts).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
68
68
 
69
69
  end
70
70
 

3

postsに修正

2021/03/06 10:43

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -34,19 +34,19 @@
34
34
 
35
35
  def index
36
36
 
37
- @post = Post.all
37
+ @posts = Posts.all
38
38
 
39
39
  end
40
40
 
41
41
  def new
42
42
 
43
- @post = Post.new
43
+ @posts = Posts.new
44
44
 
45
45
  end
46
46
 
47
47
  def create
48
48
 
49
- @post = Post.new(posts_params)
49
+ @posts = Posts.new(posts_params)
50
50
 
51
51
  if @post.save
52
52
 

2

postに修正

2021/03/06 10:40

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -34,21 +34,21 @@
34
34
 
35
35
  def index
36
36
 
37
- @posts = Post.all
37
+ @post = Post.all
38
38
 
39
39
  end
40
40
 
41
41
  def new
42
42
 
43
- @posts = Post.new
43
+ @post = Post.new
44
44
 
45
45
  end
46
46
 
47
47
  def create
48
48
 
49
- @posts = Post.new(posts_params)
49
+ @post = Post.new(posts_params)
50
-
50
+
51
- if @posts.save
51
+ if @post.save
52
52
 
53
53
  redirect_to root_path
54
54
 
@@ -64,7 +64,7 @@
64
64
 
65
65
  def posts_params
66
66
 
67
- params.require(:posts).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
67
+ params.require(:post).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
68
68
 
69
69
  end
70
70
 
@@ -74,7 +74,7 @@
74
74
 
75
75
  ```Ruby
76
76
 
77
- div class="post-sell-contents">
77
+ <div class="post-sell-contents">
78
78
 
79
79
 
80
80
 
@@ -84,7 +84,7 @@
84
84
 
85
85
  <h2 class="post-sell-title">コーデディネイトの情報を入力</h2>
86
86
 
87
- <%= form_with model:@posts,url:posts_path,local: true do |f| %>
87
+ <%= form_with model:@post,url:posts_path,local: true do |f| %>
88
88
 
89
89
 
90
90
 
@@ -244,6 +244,10 @@
244
244
 
245
245
  <% end %>
246
246
 
247
+ </div>
248
+
249
+ </div>
250
+
247
251
  ```
248
252
 
249
253
  ```javascript

1

誤字修正

2021/03/06 10:29

投稿

ryota1107
ryota1107

スコア6

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  ```Ruby
32
32
 
33
- lass PostsController < ApplicationController
33
+ class PostsController < ApplicationController
34
34
 
35
35
  def index
36
36
 
@@ -64,7 +64,7 @@
64
64
 
65
65
  def posts_params
66
66
 
67
- params.require(:posts).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
67
+ params.require(:posts).permit(:outer,:tops,:pants,:shoes,:hat,:accessory,:season_id,images:[]).merge(user_id: current_user.id)
68
68
 
69
69
  end
70
70