Skip to content

Instantly share code, notes, and snippets.

@djkz
Created April 15, 2012 16:43
Show Gist options
  • Save djkz/2393780 to your computer and use it in GitHub Desktop.
Save djkz/2393780 to your computer and use it in GitHub Desktop.
Spree 1.1 error on price sort
ActiveRecord::StatementInvalid in Spree/admin/products#index
Showing /home/tima/.rvm/gems/ruby-1.9.2-p290/gems/spree_core-1.1.0.rc1/app/views/spree/admin/products/index.html.erb where line #23 raised:
PG::Error: ERROR: column "spree_variants.price" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...updated_at, spree_products.count_on_hand ORDER BY "spree_var...
^
: SELECT "spree_products".* FROM "spree_products" LEFT OUTER JOIN "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id" AND "spree_variants".is_master = 't' AND "spree_variants".deleted_at IS NULL WHERE "spree_products"."deleted_at" IS NULL GROUP BY spree_products.id, spree_products.name, spree_products.description, spree_products.available_on, spree_products.deleted_at, spree_products.permalink, spree_products.meta_description, spree_products.meta_keywords, spree_products.tax_category_id, spree_products.shipping_category_id, spree_products.created_at, spree_products.updated_at, spree_products.count_on_hand ORDER BY "spree_variants"."price" ASC LIMIT 10 OFFSET 0
Extracted source (around line #23):
20: <th><%= sort_link @search,:master_price, t(:master_price) %></th>
21: <th data-hook="admin_products_index_header_actions"></th>
22: </tr>
23: <% @collection.each do |product| %>
24: <tr <%= "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows">
25: <td><%= product.sku rescue '' %></td>
26: <td><%= product.name rescue '' %></td>
Rails.root: /home/tima/Rails/spree1-1
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"q"=>{"deleted_at_null"=>"1",
"s"=>"master_price asc"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment