0
프로젝트에서 마스터 가격별로 제품을 정렬하지 않습니다. standart spree install을 사용합니다.잔돈을 기준으로 정렬
taxons_controller.rb 쇼 방법의수정 된 부분 :
@searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true))
@products = @searcher.retrieve_products
binding.pry
@products = @products.reorder('').send(:descend_by_master_price)
놀리려는 콘솔에서 내가 @products.reorder('').send(:descend_by_master_price)
쓰기
<Module:0x007f1e0048daa8>:0x3f8f041276b8>
.
하지만 내가 쓸 경우 Product.all.reorder('').send(:descend_by_master_price)
모든 것이 잘 동작합니다.
ActiveRecord::StatementInvalid: PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ...UB' AND "spree_products"."id" IN (5, 1) ORDER BY "spree_pri...
그래서 문제가
사람은 도움이 될 수 있습니다 ... DISTINCT에 있습니다
그리고 @products.reorder('').send(:descend_by_master_price).last
의 경우
이런 간단한 해결책! 고마워! – nuT707