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

[MySQL GROUP BY STRICT RULE] Fails to load Admin Favorites Page #12

Open
pikender opened this issue Feb 20, 2017 · 0 comments
Open

[MySQL GROUP BY STRICT RULE] Fails to load Admin Favorites Page #12

pikender opened this issue Feb 20, 2017 · 0 comments
Assignees

Comments

@pikender
Copy link
Contributor

When Visiting Products -> Favorite Products /admin/favorite_products, page shows below error

**Note: ** Error is due to MYSQL GROUP BY STRICT RULE ENABLED BY DEFAULT or check this

ActiveRecord::StatementInvalid - Mysql2::Error: Expression #1 of ORDER BY contains aggregate function and applies to the result of a non-aggregated query: SELECT  DISTINCT `spree_products`.* FROM `spree_products` INNER JOIN `spree_favorites` ON `spree_favorites`.`product_id` = `spree_products`.`id` WHERE `spree_products`.`deleted_at` IS NULL  ORDER BY count(spree_favorites.user_id) desc LIMIT 25 OFFSET 0:
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:473:in `translate_exception_class'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:486:in `rescue in log'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:484:in `log'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `execute'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/mysql2_adapter.rb:235:in `exec_query'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/database_statements.rb:356:in `select'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'
  activerecord (4.2.7.1) lib/active_record/querying.rb:39:in `find_by_sql'
  activerecord (4.2.7.1) lib/active_record/relation.rb:639:in `exec_queries'
  activerecord (4.2.7.1) lib/active_record/relation.rb:515:in `load'
  activerecord (4.2.7.1) lib/active_record/relation.rb:243:in `to_a'
  activerecord (4.2.7.1) lib/active_record/relation/delegation.rb:46:in `each'
  /Users/pikender/spree/marketing/products/spree_favorite_products/app/views/spree/admin/favorite_products/index.html.erb:26:in `_159f37bc5a59b9d09b8a7c99092e39eb'
@pikender pikender self-assigned this Feb 20, 2017
tanmay3011 added a commit that referenced this issue Feb 21, 2017
Fixes #12 and adds style to Mark/Unmark as favorite buttons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant