brendon / acts_as_list

An ActiveRecord plugin for managing lists.
http://brendon.github.io/acts_as_list/
MIT License
2.04k stars 355 forks source link

remove_from_list causing "wrong number of arguments (given 2, expected 0..1)" #293

Closed trackedsupport closed 6 years ago

trackedsupport commented 6 years ago

I noticed when I call remove_from list or destroy this error happens. It could very well be something I'm doing since I don't see anyone else having this issue. Does anyone know why this would occur?

"wrong number of arguments (given 2, expected 0..1)"

brendon commented 6 years ago

Hi @trackedsupport, can you provide us with a stack trace? Be sure to format it as code in the post so it's easier for us to look at :)

I suspect it'll be some configuration or usage error on your end though at this stage.

trackedsupport commented 6 years ago

There's really not much of a stack trace to show. I don't actually see a stack trace showing acts_as_lists classes, only my own classes. But it seems to all point to that one method. I only got the error one day so maybe there was an issue with the server and multiple requests hitting at the same time. I'm going to close for now since it sounds like an issue on my side. Thanks!

brendon commented 6 years ago

Ok, make sure you select Application from the error screen to show the entire trace and not just the files from your application. Then you'll see the acs_as_list lines referenced.

trackedsupport commented 6 years ago

I coudn't reproduce but i configured it so exception notification would inform me of the full backtrace. Could it be an issue with one of these dependent destroy callbacks? Ive never seen this before! Thanks again for any help!

  belongs_to :list
  acts_as_list scope: :list, add_new_at: :top
  has_many :todo_labels, dependent: :destroy
  has_many :todo_assignees, dependent: :destroy
 vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/errors.rb:98:in `initialize'
  vendor/bundle/ruby/2.3.0/gems/transaction_isolation-1.0.3/lib/transaction_isolation/active_record/connection_adapters/mysql2_adapter.rb:57:in `new'
  vendor/bundle/ruby/2.3.0/gems/transaction_isolation-1.0.3/lib/transaction_isolation/active_record/connection_adapters/mysql2_adapter.rb:57:in `translate_exception_with_transaction_isolation_conflict'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:597:in `translate_exception_class'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:616:in `rescue in log'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:610:in `log'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:212:in `execute'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/mysql/database_statements.rb:31:in `execute'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:223:in `execute_and_free'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/mysql/database_statements.rb:48:in `exec_delete'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:135:in `delete'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb:17:in `delete'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/relation.rb:510:in `delete_all'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/persistence.rb:554:in `destroy_row'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/counter_cache.rb:191:in `destroy_row'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/locking/optimistic.rb:117:in `destroy_row'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/persistence.rb:195:in `destroy'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/callbacks.rb:321:in `block in destroy'
  vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:131:in `run_callbacks'
  vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.1/lib/active_support/callbacks.rb:825:in `_run_destroy_callbacks'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/callbacks.rb:321:in `destroy'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/transactions.rb:303:in `block in destroy'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:225:in `block in transaction'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
  vendor/ruby-2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:225:in `transaction'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/transactions.rb:210:in `transaction'
  vendor/bundle/ruby/2.3.0/gems/transaction_retry-1.0.2/lib/transaction_retry/active_record/base.rb:23:in `transaction_with_retry'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/transactions.rb:303:in `destroy'
  vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.1/lib/active_record/persistence.rb:211:in `destroy!'
  app/controllers/webhooks_controller.rb:23:in `process_todo'
brendon commented 6 years ago

Sorry man, there's not enough information there to help me figure out what the problem is. If you can get it breaking again, and get a full stack trace let me know. I suspect it might be an issue specific to your application but if you find otherwise I'm more than happy to take a look provided you can get me a good amount of info on the issue :D