Running rails g spree:auth:install abort with "... wrong number of arguments (given 3, expected 2)"

168 Views Asked by At

I am trying to install a new Spree applicattion using the GitHub guide but when I run the install generator rails g spree:auth:install, I get the following error:

 rails g spree:auth:install                                 
Running via Spring preloader in process 4189
      append  vendor/assets/javascripts/spree/frontend/all.js
      create  config/initializers/devise.rb
         run  bundle exec rake railties:install:migrations FROM=spree_auth from "."
         run  bundle exec rake db:migrate VERBOSE=false from "."
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

wrong number of arguments (given 3, expected 2)
/home/work/.rvm/gems/ruby-2.5.1/gems/polyamorous-1.3.3/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb:58:in `join_constraints'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:1027:in `build_join_query'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:1009:in `build_joins'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:929:in `build_arel'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:903:in `arel'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation.rb:329:in `update_all'
/home/work/pg_spree/db/migrate/20180810234081_make_existing_credit_cards_default.spree.rb:6:in `up'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:817:in `exec_migration'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:797:in `block in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:414:in `with_connection'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:796:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `ddl_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `each'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `block in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/home/work/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/work/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/home/work/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'

Caused by:
ArgumentError: wrong number of arguments (given 3, expected 2)
/home/work/.rvm/gems/ruby-2.5.1/gems/polyamorous-1.3.3/lib/polyamorous/activerecord_5.2_ruby_2/join_dependency.rb:58:in `join_constraints'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:1027:in `build_join_query'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:1009:in `build_joins'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:929:in `build_arel'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation/query_methods.rb:903:in `arel'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/relation.rb:329:in `update_all'
/home/work/pg_spree/db/migrate/20180810234081_make_existing_credit_cards_default.spree.rb:6:in `up'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:817:in `exec_migration'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:797:in `block in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:414:in `with_connection'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:796:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `ddl_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `each'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `block in migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/home/work/.rvm/gems/ruby-2.5.1/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/home/work/.rvm/gems/ruby-2.5.1/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/work/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
/home/work/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Any idea about this? I don't know what is causing this error and googling didn't help much.

Edit:

Seems like this was due to the new Rails released two days ago (Version 5.2.1)

Rolling back to version 5.2.0 solved this issue for me.

1

There are 1 best solutions below

0
On

The stack trace points to the polyamorous gem, which is now a part of ransack. You need to bump ransack to ~> 2.0 as it adds support for active record 5.2.1