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

質問編集履歴

2

each doメソッドの前後にもeach doを入れているため、もしかして前後に原因があるかもと思い変更しました。

2019/09/13 08:10

投稿

marco
marco

スコア33

title CHANGED
File without changes
body CHANGED
@@ -8,24 +8,84 @@
8
8
 
9
9
  どなたかわかるかた教えていただけたら幸いです。
10
10
 
11
- ```HTML
11
+ ```HTML
12
+ <div class="mypage-contents">
13
+ <div class="tab_wrap">
14
+ <input id="tab1" type="radio" name="tab_btn" checked>
15
+ <input id="tab2" type="radio" name="tab_btn">
16
+ <input id="tab3" type="radio" name="tab_btn">
17
+ <div class="tab_area">
12
- <% if @user.id == current_user.id %>
18
+ <% if @user.id == current_user.id %>
19
+ <label class="tab1_label" for="tab1">MYNOTE</label>
20
+ <label class="tab2_label" for="tab2">いいねのNOTE</label>
21
+ <% else %>
22
+ <label class="tab1_label" for="tab1">
23
+ <%= @user.name %>のNOTE</label>
24
+ <% end %>
25
+ <% if @user.id == current_user.id %>
26
+ <label class="tab3_label" for="tab3">コメントしたNOTE</label>
27
+ <% end %>
28
+ </div>
29
+ <div class="panel_area">
30
+ <div id="panel1" class="tab_panel">
31
+ <% @note.each do |note| %>
32
+ <div class="mylist">
33
+ <h2>
34
+ <%= link_to note.title, note, class: 'mylist-buttom' %>
35
+ </h2>
36
+ <% if @user.id == current_user.id %>
37
+ <div class="mylist-right">
38
+ <% if @user.id == current_user.id %>
39
+ <p>
40
+ <%= link_to '編集 ', edit_note_path(note),class: 'mylist-buttom'%>
41
+ </p>
42
+ <p>
43
+ <%= link_to '削除', note, method: :delete, data: { confirm: 'Are you sure?' } ,class: 'mylist-buttom'%>
44
+ </p>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+ </div>
49
+ <% end %>
50
+ <% if @user.id == current_user.id %>
13
- <div id="panel2" class="tab_panel">
51
+ <div id="panel2" class="tab_panel">
14
- <% @goods.each do |good| %>
52
+ <% @goods.each do |good| %>
15
- <div class="mylist">
53
+ <div class="mylist">
16
- <% note= Note.find_by(id: good.note_id) %>
54
+ <% note= Note.find_by(id: good.note_id) %>
17
- <h2>
55
+ <h2>
18
- <%= link_to(note.title, "/notes/#{note.id}") %>
56
+ <%= link_to(note.title, "/notes/#{note.id}") %>
19
- </h2>
57
+ </h2>
20
- <div class="mylist-right">
58
+ <div class="mylist-right">
21
- <p>
59
+ <p>
22
- <%= link_to 'Show', note, class: 'buttom' %>
60
+ <%= link_to 'Show', note, class: 'buttom' %>
23
- </p>
61
+ </p>
24
- </div>
62
+ </div>
25
- </div>
63
+ </div>
26
- <% end %>
64
+ <% end %>
27
-       <% end %>a
65
+ <% end %>a
28
- </div>
66
+ </div>
67
+ <% if @user.id == current_user.id %>
68
+ <div id="panel3" class="tab_panel">
69
+ <% @comments.uniq.each do |c| %>
70
+ <div class="mylist">
71
+ <% c.body %>
72
+ <% note= Note.find_by(id: c.note_id) %>
73
+ <h2>
74
+ <%= link_to(note.title, "/notes/#{note.id}") %>
75
+ </h2>
76
+ <div class="mylist-right">
77
+ <p>
78
+ <%= link_to 'Show', note, class: 'u-buttom' %>
79
+ </p>
80
+ </div>
81
+ </div>
82
+ <% end %>
83
+ <% end %>
84
+ <% end %>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </div>
29
89
  ```
30
90
 
31
91
  ```controller

1

文章の最後にスクリーンショット画像添付しました。

2019/09/13 08:10

投稿

marco
marco

スコア33

title CHANGED
File without changes
body CHANGED
@@ -35,4 +35,5 @@
35
35
  @goods = Good.where(user_id:@user.id)
36
36
  @comments = Comment.where(user_id:@user.id)
37
37
  end
38
- ```
38
+ ```
39
+ ![イメージ説明](b7c87d1b40e1f18e6194dade22c3a113.png)