質問編集履歴
2
タイトルの修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Rails 並び替え機能を実装したい
|
1
|
+
「Ruby on Rails」 商品の並び替え機能を実装したい。
|
test
CHANGED
File without changes
|
1
JSのコードを修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,13 +90,13 @@
|
|
90
90
|
|
91
91
|
@products = Product.all.order('price DESC')
|
92
92
|
|
93
|
+
elsif params[:option] == "created_at_asc"
|
94
|
+
|
95
|
+
@products = Product.all.order('created_at ASC')
|
96
|
+
|
93
|
-
elsif params[:option] == "created_at
|
97
|
+
elsif params[:option] == "created_at_desc"
|
94
98
|
|
95
99
|
@products = Product.all.order('created_at DESC')
|
96
|
-
|
97
|
-
elsif params[:option] == "created_at asc"
|
98
|
-
|
99
|
-
@products = Product.all.order('created_at ASC')
|
100
100
|
|
101
101
|
end
|
102
102
|
|