Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in orders index when using spree_globalize #95

Open
Kulgar opened this issue Sep 23, 2020 · 0 comments
Open

Bug in orders index when using spree_globalize #95

Kulgar opened this issue Sep 23, 2020 · 0 comments

Comments

@Kulgar
Copy link
Contributor

Kulgar commented Sep 23, 2020

I get this error when using spree mollie gateway with spree globalize :
(Strange fact: I get the error once the app is deployed, not in my dev environment...)

ActionView::Template::Error (PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ...store_translations"."locale" IN ($1, $2) ORDER BY spree_stor...
                                                             ^
: SELECT DISTINCT spree_store_translations.name, "spree_stores"."id" FROM "spree_stores" INNER JOIN "spree_store_translations" ON "spree_store_translations"."spree_store_id" = "spree_stores"."id" WHERE "spree_store_translations"."locale" IN ($1, $2) ORDER BY spree_stores.name):

<div class="col-xs-12 col-md-4">
  <div class="form-group">
    <%= label_tag :q_store_id_in, Spree.t(:store) %>
    <%= f.select :store_id_in, Spree::Store.order("#{Spree::Store.table_name}.name").pluck(:name, :id), {include_blank: true}, class: 'select2' %>
  </div>
</div>

I actually don't understand why you put "#{Spree::Store.table_name}" in the above line. A simple Spree::Store.order("name").pluck(:name, :id), works just fine and doesn't raise the above bug.

And, indeed, this is the code used in official backend repository: https://github.com/spree/spree/blob/master/backend/app/views/spree/admin/orders/index.html.erb#L134

Could that be fixed? Thanks! (I'll open a little PR)

Could I also open another PR that gets all updates from official backend files to this gem?

Kulgar added a commit to Kulgar/spree-mollie-gateway that referenced this issue Sep 23, 2020
This little PR fixes issue mollie#95
@Kulgar Kulgar mentioned this issue Sep 23, 2020
Oldharlem added a commit that referenced this issue Jul 12, 2021
Oldharlem pushed a commit that referenced this issue Aug 8, 2021
This little PR fixes issue #95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant