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

質問編集履歴

5

補足

2021/04/27 14:24

投稿

popi06
popi06

スコア3

title CHANGED
File without changes
body CHANGED
@@ -110,4 +110,22 @@
110
110
  <%= b.file_field :image, accept: "image/jpeg,image/gif,image/png" %>
111
111
  </span>
112
112
  <% end %>
113
+ ```
114
+ ### ログ
115
+ ```ここに言語を入力
116
+ Started POST "/circleposts" for 126.227.240.207 at 2021-04-27 14:19:34 +0000
117
+ Cannot render console from 126.227.240.207! Allowed networks: 126.227.199.43, 127.0.0.0/127.255.255.255, ::1
118
+ (1.8ms) SELECT sqlite_version(*)
119
+ (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
120
+ Processing by CirclepostsController#create as HTML
121
+ Parameters: {"authenticity_token"=>"pgdArkzFtgJKP1AYL0hjpJTnRBpCaQL47awdeH/E1svA88nIqY/RrdXLROzMzH7BW6L9YRcL4aA8rGPx26PkLg==", "circlepost"=>{"content"=>"d"}, "commit"=>"投稿"}
122
+ User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
123
+ ↳ app/helpers/sessions_helper.rb:18:in `current_user'
124
+ Circle Load (0.8ms) SELECT "circles".* FROM "circles" WHERE "circles"."id" IS NULL LIMIT ? [["LIMIT", 1]]
125
+ ↳ app/controllers/circleposts_controller.rb:7:in `create'
126
+ Completed 422 Unprocessable Entity in 424ms (ActiveRecord: 5.1ms | Allocations: 207665)
127
+
128
+
129
+
130
+ ActiveRecord::RecordInvalid (バリデーションに失敗しました: Circleを入力してくださ
113
131
  ```

4

補足

2021/04/27 14:24

投稿

popi06
popi06

スコア3

title CHANGED
File without changes
body CHANGED
File without changes

3

viewの追加

2021/04/27 11:45

投稿

popi06
popi06

スコア3

title CHANGED
File without changes
body CHANGED
@@ -72,4 +72,42 @@
72
72
  belongs_to :user
73
73
 
74
74
  ユーザーとグループに関連づけています。※ユーザーとグループ側にも関連付けしています。
75
+ ```
76
+ ```ここに言語を入力
77
+ /app/views/circles/postlist.html.erb
78
+
79
+ <% provide(:title, 'postlist') %>
80
+
81
+ <h3 class="circle-name"><%= @circle.name %></h3>
82
+ <div class="postlist">
83
+ <% if @circle.circle_user?(current_user) %>
84
+ <section class="circlepost_form">
85
+ <%= render 'shared/circlepost_form' %>
86
+ </section>
87
+ <% end %>
88
+
89
+ <% if @circle.circleposts.any? %>
90
+ <ol class="circleposts">
91
+ <%= render @circleposts %>
92
+ </ol>
93
+ <div class="page">
94
+ <%= will_paginate @circleposts, { :previous_label => '&lt 前へ', :next_label => '次へ &gt' } %>
95
+ </div>
96
+ <% end %>
97
+ </div>
98
+
99
+ ```
100
+ ```ここに言語を入力
101
+ /app/views/shared/_circlepost_form.html.erb
102
+
103
+ <%= form_with(model: @circlepost, local: true) do |b| %>
104
+ <%= render 'shared/error_messages_second', object: b.object %>
105
+ <div class="field">
106
+ <%= b.text_area :content, placeholder: "(例) 活動時間を変更したので確認してください!" %>
107
+ </div>
108
+ <%= b.submit "投稿", class: "btn btn-warning" %>
109
+ <span class="image">
110
+ <%= b.file_field :image, accept: "image/jpeg,image/gif,image/png" %>
111
+ </span>
112
+ <% end %>
75
113
  ```

2

補足

2021/04/27 08:36

投稿

popi06
popi06

スコア3

title CHANGED
File without changes
body CHANGED
@@ -10,7 +10,7 @@
10
10
  circlepost(グループ投稿)
11
11
 
12
12
  ---
13
- これはルートに問題があるのかコントローラーに問題があるのかわかりません。わかりすく解決方法を教えていただけると嬉しいです。
13
+ これはルートに問題があるのかコントローラーに問題があるのかわかりません。ルートコントローラーいじってみても分からなかったので、どういったように変更すれば良いか教えていただきたいです。
14
14
 
15
15
  ちなみにグループの投稿はpostlistというページに表示するようにしています。
16
16
 

1

補足

2021/04/27 06:29

投稿

popi06
popi06

スコア3

title CHANGED
File without changes
body CHANGED
@@ -70,4 +70,6 @@
70
70
  ```ここに言語を入力
71
71
  belongs_to :circle, optional: true
72
72
  belongs_to :user
73
+
74
+ ユーザーとグループに関連づけています。※ユーザーとグループ側にも関連付けしています。
73
75
  ```