質問編集履歴
1
コードの一部のミスを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
def by_categories
|
38
38
|
|
39
|
-
post_ids = Category.where(id: [1,2,3]).map{ |c| c.posts.ids }
|
39
|
+
post_ids = Category.where(id: [1,2,3]).map{ |c| c.posts.ids }.flatten
|
40
40
|
|
41
41
|
@posts = Post.where(id: post_ids).order(created_at: :desc)
|
42
42
|
|