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

回答編集履歴

2

言葉遣いの修正

2017/11/13 13:57

投稿

sol_n
sol_n

スコア27

answer CHANGED
@@ -1,16 +1,16 @@
1
1
  やりたいことは、
2
2
 
3
3
  microposts/index.html.haml
4
-  ーーーーーーーーー
4
+   ーーーーーーーーー
5
5
  |ポスト1 [いいね!]|
6
6
  |ポスト2 [いいね!]|
7
7
  |ポスト3 [いいね!]|
8
-  ーーーーーーーーー
8
+   ーーーーーーーーー
9
9
 
10
10
  のような一覧画面を作りたいということであっていますか?
11
11
  であれば、質問者さんが挙げられているhttps://qiita.com/mikan3rd/items/21d716026b51331e53a1こちらのページがまさにそれをやっています。
12
12
 
13
- 具体的には、下記のような感じです。
13
+ 具体的には、下記のように書けばきると思います。
14
14
 
15
15
  ```ruby
16
16
  #views/microposts/index.html.haml

1

誤字修正

2017/11/13 13:57

投稿

sol_n
sol_n

スコア27

answer CHANGED
@@ -27,14 +27,14 @@
27
27
  ```ruby
28
28
  #views/likes/_like_links.html.haml
29
29
  #いいねボタン
30
- if current_user.likes.find_by(tweet_id: tweet.id)
30
+ if current_user.likes.find_by(micropost_id: micropost.id)
31
- = link_to unlike_path(tweet.id), method: :delete, remote: true do
31
+ = link_to unlike_path(micropost.id), method: :delete, remote: true do
32
- .btn.btn-default.glyphicon.glyphicon-heart{id: "heart-#{tweet.id}"}
32
+ .btn.btn-default.glyphicon.glyphicon-heart{id: "heart-#{micropost.id}"}
33
- = tweet.likes.count.to_s
33
+ = micropost.likes.count.to_s
34
34
  - else
35
- = link_to like_path(tweet.id), method: :post, remote: true do
35
+ = link_to like_path(micropost.id), method: :post, remote: true do
36
- .btn.btn-default.glyphicon.glyphicon-heart-empty{id: "heart-#{tweet.id}"}
36
+ .btn.btn-default.glyphicon.glyphicon-heart-empty{id: "heart-#{micropost.id}"}
37
- = tweet.likes.count.to_s
37
+ = micropost.likes.count.to_s
38
38
  ```
39
39
 
40
40
  的外れでしたらすみませんm(_ _)m