私はフィールドに使用してアクティブレコードのクエリを注文するtriyingだ。
私はまずcreated_atで注文し、次に優先度フィールド(1,2,3 ...の値を含む)を使う必要があります。
私はこのコードで試してみますが、動作しません。
@products = Product.all.limit(10).order("created_at").order("priority")
前もって感謝します
all gives you an array, not a relation. Just remove it.
all
@products = Product.all.limit(10).order( "created_at、priority")は機能しますか?
@products = Product.all.limit(10).order( "created_at、priority")
array
Product.order(:created_at, :priority).limit(10)