RubyMoney / money-rails

Integration of RubyMoney - Money with Rails
MIT License
1.8k stars 387 forks source link

`t.monetize :price` raises an error on Ruby 3.0.0 Preview 1 #612

Closed dcangulo closed 3 years ago

dcangulo commented 3 years ago

I'm not sure if this is a Ruby 3.0.0 error and I just wanna let you know.

So I'm testing my app on Ruby 3.0.0 Preview 1 and it raises the error.

wrong number of arguments (given 3, expected 2)

When using:

t.monetize :price

Temporary solution:

t.integer :price_cents, default: 0, null: false
t.string :price_currency, default: MoneyRails.default_currency.to_s, null: false
antstorm commented 3 years ago

@dcangulo would you mind posting the full backtrace? I'm suspecting it's because of the splat and double splat operator usage that has changed in Ruby 3

dcangulo commented 3 years ago

@antstorm

Gemfile:

gem 'money-rails', '~> 1.13', '>= 1.13.3'

Migration file:

class CreateProducts < ActiveRecord::Migration[6.0]
  def change
    create_table :products do |t|
      t.string :name
      t.monetize :price
      t.timestamps
    end
  end
end

Model:

class Product < ApplicationRecord
  monetize :price_cents
end

Stacktrace:

davids-mbp:test_money_rails davidangulo$ bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
== 20201201045045 CreateProducts: migrating ===================================
-- create_table(:products)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

wrong number of arguments (given 3, expected 2)
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:364:in `column'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:8:in `block in monetize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:6:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:6:in `monetize'
/Users/davidangulo/Desktop/apps/test_money_rails/db/migrate/20201201045045_create_products.rb:5:in `block in change'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:890:in `block in method_missing'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:858:in `block in say_with_time'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:858:in `say_with_time'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:879:in `method_missing'
/Users/davidangulo/Desktop/apps/test_money_rails/db/migrate/20201201045045_create_products.rb:3:in `change'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:828:in `exec_migration'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:811:in `block in migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:810:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1002:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb:212:in `transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1361:in `ddl_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1280:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1231:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1061:in `up'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1036:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <main>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:84:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <main>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:83:in `block in run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/rake:23:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/rake:23:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:481:in `exec'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bundler-2.2.0.rc.1/libexec/bundle:49:in `block in <top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bundler-2.2.0.rc.1/libexec/bundle:37:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/bundle:23:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/bundle:23:in `<main>'

Caused by:
ArgumentError: wrong number of arguments (given 3, expected 2)
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:364:in `column'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:8:in `block in monetize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:6:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/money-rails-1.13.3/lib/money-rails/active_record/migration_extensions/table_pg_rails4.rb:6:in `monetize'
/Users/davidangulo/Desktop/apps/test_money_rails/db/migrate/20201201045045_create_products.rb:5:in `block in change'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:890:in `block in method_missing'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:858:in `block in say_with_time'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:858:in `say_with_time'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:879:in `method_missing'
/Users/davidangulo/Desktop/apps/test_money_rails/db/migrate/20201201045045_create_products.rb:3:in `change'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:828:in `exec_migration'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/benchmark.rb:293:in `measure'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:811:in `block in migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:810:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1002:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activesupport-6.0.3.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/transactions.rb:212:in `transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1361:in `ddl_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1280:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1231:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1061:in `up'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/migration.rb:1036:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <main>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:84:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <main>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:83:in `block in run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/rake:23:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/rake:23:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:481:in `exec'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bundler-2.2.0.rc.1/libexec/bundle:49:in `block in <top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/3.0.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/lib/ruby/gems/3.0.0/gems/bundler-2.2.0.rc.1/libexec/bundle:37:in `<top (required)>'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/bundle:23:in `load'
/Users/davidangulo/.rbenv/versions/3.0.0-preview1/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
juanmanuelramallo commented 3 years ago

Same error on latest ruby ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]

maxrosecollins commented 3 years ago

I think I am getting the same error ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

class CreateProducts < ActiveRecord::Migration[6.1]
  def change
    create_table :products do |t|
      t.uuid    :uuid, default: 'uuid_generate_v4()'
      t.string  :name
      t.text    :description
      t.string  :provider
      t.string  :status
      t.boolean :published, default: false
      t.timestamps
    end

    add_monetize :products, :price, currency: { present: true }
  end
end
== 20210114133700 CreateProducts: migrating ===================================
-- create_table(:products)
   -> 0.0047s
-- add_column(:products, "price_cents", :integer, {:null=>false, :default=>0})
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

wrong number of arguments (given 4, expected 3)
/Users/max/Projects/#/db/migrate/20210114133700_create_products.rb:13:in `change'
juanmanuelramallo commented 3 years ago

Hey @maxrosecollins, can you please try using this in your gemfile:

gem 'money-rails', github: 'juanmanuelramallo/money-rails', branch: 'ruby-3-support-migration-extension'

Then run bundle install and try running your migrations once again.

That branch is this PR #617