ActiveRecord::StatementInvalid in Erp::OnlineStore::Frontend::Category#detail

Showing /hdd/timhangcongnghe/prod/engines/online_store/app/views/erp/online_store/frontend/category/detail.html.erb where line #196 raised:

PG::SyntaxError: ERROR:  syntax error at or near "-"
LINE 1: ...16 ORDER BY visit DESC,created_at DESC, visit DESC-created_a...
                                                             ^
: SELECT  "erp_products_products".* FROM "erp_products_products" WHERE "erp_products_products"."archived" = $1 AND "erp_products_products"."is_sold_out" = $2 AND "erp_products_products"."category_id" = 216 ORDER BY visit DESC,created_at DESC, visit DESC-created_at DESC LIMIT $3 OFFSET $4
Extracted source (around line #624):
622
623
624
625
626
627
              
log(sql, name, binds, type_casted_binds) do
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
@connection.exec_params(sql, type_casted_binds)
end
end
end

Rails.root: /hdd/timhangcongnghe/prod

Application Trace | Framework Trace | Full Trace
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:624:in `async_exec'
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:624:in `block (2 levels) in exec_no_cache'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
activesupport (5.1.7) lib/active_support/concurrency/share_lock.rb:185:in `yield_shares'
activesupport (5.1.7) lib/active_support/dependencies/interlock.rb:45:in `permit_concurrent_loads'
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:623:in `block in exec_no_cache'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract_adapter.rb:613:in `block (2 levels) in log'
/home/hoangkhang/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract_adapter.rb:612:in `block in log'
activesupport (5.1.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract_adapter.rb:604:in `log'
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:622:in `exec_no_cache'
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql_adapter.rb:611:in `execute_and_clear'
activerecord (5.1.7) lib/active_record/connection_adapters/postgresql/database_statements.rb:79:in `exec_query'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/database_statements.rb:42:in `select_all'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/query_cache.rb:95:in `block in select_all'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/query_cache.rb:118:in `block in cache_sql'
/home/hoangkhang/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/query_cache.rb:104:in `cache_sql'
activerecord (5.1.7) lib/active_record/connection_adapters/abstract/query_cache.rb:95:in `select_all'
activerecord (5.1.7) lib/active_record/querying.rb:39:in `find_by_sql'
activerecord (5.1.7) lib/active_record/relation.rb:678:in `exec_queries'
activerecord (5.1.7) lib/active_record/relation.rb:546:in `load'
activerecord (5.1.7) lib/active_record/relation.rb:255:in `records'
activerecord (5.1.7) lib/active_record/relation/delegation.rb:39:in `each'
engines/online_store/app/views/erp/online_store/frontend/category/detail.html.erb:196:in `_309302a34fe50d61d789c73be0064b02'
actionview (5.1.7) lib/action_view/template.rb:157:in `block in render'
activesupport (5.1.7) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.1.7) lib/action_view/template.rb:352:in `instrument_render_template'
actionview (5.1.7) lib/action_view/template.rb:155:in `render'
deface (1.5.3) lib/deface/action_view_extensions.rb:43:in `render'
actionview (5.1.7) lib/action_view/renderer/template_renderer.rb:52:in `block (2 levels) in render_template'
actionview (5.1.7) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
activesupport (5.1.7) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.7) lib/active_support/notifications.rb:166:in `instrument'
actionview (5.1.7) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
actionview (5.1.7) lib/action_view/renderer/template_renderer.rb:51:in `block in render_template'
actionview (5.1.7) lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
actionview (5.1.7) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.7) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.7) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.1.7) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.1.7) lib/action_view/rendering.rb:103:in `_render_template'
actionpack (5.1.7) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.1.7) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.1.7) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.1.7) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (5.1.7) lib/abstract_controller/rendering.rb:24:in `render'
actionpack (5.1.7) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.1.7) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/hoangkhang/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
activesupport (5.1.7) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (5.1.7) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:43:in `render'
wicked_pdf (2.6.3) lib/wicked_pdf/pdf_helper.rb:18:in `render'
actionpack (5.1.7) lib/action_controller/metal/implicit_render.rb:33:in `default_render'
actionpack (5.1.7) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
actionpack (5.1.7) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
actionpack (5.1.7) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.7) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.7) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.7) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.7) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.7) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.7) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.7) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.7) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.7) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.7) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.7) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.7) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.7) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.7) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.7) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.7) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:844:in `call'
railties (5.1.7) lib/rails/engine.rb:522:in `call'
railties (5.1.7) lib/rails/railtie.rb:185:in `public_send'
railties (5.1.7) lib/rails/railtie.rb:185:in `method_missing'
actionpack (5.1.7) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.1.7) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.7) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.7) lib/action_dispatch/routing/route_set.rb:844:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/static.rb:125:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/static.rb:125:in `call'
omniauth (2.1.1) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.1) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.1) lib/omniauth/builder.rb:44:in `call'
omniauth (2.1.1) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.1) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.1) lib/omniauth/builder.rb:44:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (2.2.6.2) lib/rack/etag.rb:27:in `call'
rack (2.2.6.2) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.6.2) lib/rack/head.rb:12:in `call'
rack (2.2.6.2) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.6.2) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/cookies.rb:613:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.7) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.7) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.7) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.7) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.2.6.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.6.2) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.7) lib/action_dispatch/middleware/executor.rb:12:in `call'
rack (2.2.6.2) lib/rack/sendfile.rb:110:in `call'
railties (5.1.7) lib/rails/engine.rb:522:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:561:in `maintain_worker_count'
unicorn (6.1.0) lib/unicorn/http_server.rb:294:in `join'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
/home/hoangkhang/.rvm/gems/ruby-2.3.3/bin/unicorn:23:in `load'
/home/hoangkhang/.rvm/gems/ruby-2.3.3/bin/unicorn:23:in `<main>'
/home/hoangkhang/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:24:in `eval'
/home/hoangkhang/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:24:in `<main>'

Request

Parameters:

{"sort_by"=>"visit DESC-created_at DESC", "category_name"=>"o-cung-ssd-msata", "category_id"=>"408"}

Response

Headers:

None