kvokka / pp_sql

Rails ActiveRecord SQL queries log beautifier
MIT License
265 stars 9 forks source link

ArgumentError: wrong number of arguments (given 1, expected 2) #8

Closed gambala closed 6 years ago

gambala commented 7 years ago

Ruby 2.4, Rails 5.1.3

Call User.find(373481379) in pry console. Get an error.

Stack trace:

Could not log "sql.active_record" event. ArgumentError: wrong number of arguments (given 1, expected 2)
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/log_subscriber.rb:50:in `render_bind'
/home/gambala/.rvm/gems/ruby-2.4.1/bundler/gems/pp_sql-fbe46d0df86d/lib/pp_sql.rb:79:in `block in sql'
/home/gambala/.rvm/gems/ruby-2.4.1/bundler/gems/pp_sql-fbe46d0df86d/lib/pp_sql.rb:78:in `map'
/home/gambala/.rvm/gems/ruby-2.4.1/bundler/gems/pp_sql-fbe46d0df86d/lib/pp_sql.rb:78:in `sql'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/subscriber.rb:99:in `finish'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/log_subscriber.rb:83:in `finish'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/fanout.rb:102:in `finish'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/fanout.rb:46:in `block in finish'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/fanout.rb:46:in `each'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/fanout.rb:46:in `finish'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/instrumenter.rb:42:in `finish_with_state'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/notifications/instrumenter.rb:27:in `instrument'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:603:in `log'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:612:in `exec_no_cache'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `execute_and_clear'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:79:in `exec_query'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:42:in `select_all'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/connection_adapters/abstract/query_cache.rb:97:in `select_all'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/querying.rb:39:in `find_by_sql'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/statement_cache.rb:107:in `execute'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.3/lib/active_record/core.rb:187:in `find'
(pry):6:in `__pry__'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:355:in `eval'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:355:in `evaluate_ruby'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:323:in `handle_line'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:243:in `block (2 levels) in eval'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:242:in `catch'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:242:in `block in eval'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:241:in `catch'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_instance.rb:241:in `eval'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:77:in `block in repl'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:67:in `loop'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:67:in `repl'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:38:in `block in start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/input_lock.rb:79:in `with_ownership'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:38:in `start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/repl.rb:15:in `start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/pry-0.10.4/lib/pry/pry_class.rb:169:in `start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:62:in `start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:17:in `start'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/commands/console/console_command.rb:85:in `perform'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/command/base.rb:63:in `perform'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/command.rb:44:in `invoke'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/railties-5.1.3/lib/rails/commands.rb:16:in `<top (required)>'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:17:in `require'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `block in require'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in `require'
/home/gambala/git/melp-rails/bin/rails:9:in `<top (required)>'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/bootsnap-1.1.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `load'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:286:in `block in load'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:286:in `load'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/commands/rails.rb:6:in `call'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/command_wrapper.rb:38:in `call'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:201:in `block in serve'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:171:in `serve'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
/home/gambala/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
/home/gambala/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/gambala/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'

P.S. On some queries if I call .to_sql method after query — I get properly formatted sql. But User.find(373481379).to_sql gives me the same error.

joemsak commented 6 years ago

Same exact error, came here to see if it's been reported.

kvokka commented 6 years ago

Fixed in version 0.2.8