Issue #18182 has been reported by yahonda (Yasuo Honda).

----------------------------------------
Bug #18182: wrong number of arguments (given 1, expected 0) (ArgumentError) since 178ee1e801acb33d13b3e8a630f6ca4926c68fbc
https://bugs.ruby-lang.org/issues/18182

* Author: yahonda (Yasuo Honda)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-09-21T04:05:27Z master 98c5907c65) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
* Steps to reproduce

```
git clone https://github.com/rails/rails
cd rails/guides/bug_report_templates
ruby active_record_main.rb
```

* Expected behavior as Ruby 3.0.2

It should finish as follows.
```
1 runs, 3 assertions, 0 failures, 0 errors, 0 skips
```

* Actual behavior
It always raises `ArgumentError` as follows.

```
yahonda@myryzen:~/src/github.com/rails/rails/guides/bug_report_templates$ ruby active_record_main.rb
Fetching gem metadata from https://rubygems.org/......
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using thor 1.1.0
Using minitest 5.14.4
Using tzinfo 2.0.4
Using mini_portile2 2.6.1
Using racc 1.5.2
Using crass 1.0.6
Using rack 2.2.3
Using nio4r 2.5.8
Using sprockets 4.0.2
Using websocket-extensions 0.1.5
Using mini_mime 1.1.1
Using websocket-driver 0.7.5
Using method_source 1.0.0
Using zeitwerk 2.5.0.beta3
Using sqlite3 1.4.2
Using builder 3.2.4
Using erubi 1.10.0
Using i18n 1.8.10
Using nokogiri 1.12.4
Using activesupport 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using marcel 1.0.2
Using mail 2.7.1
Using bundler 2.3.0.dev
Using rack-test 1.1.0
Using loofah 2.12.0
Using rails-html-sanitizer 1.4.2
Using globalid 0.5.2
Using activemodel 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using rails-dom-testing 2.0.3
Using activejob 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using activerecord 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using actionview 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using actionpack 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using activestorage 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using actionmailer 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using railties 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using sprockets-rails 3.2.2
Using actioncable 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using actiontext 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using actionmailbox 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
Using rails 7.0.0.alpha2 from https://github.com/rails/rails.git (at /home/yahonda/src/github.com/rails/rails@1a240cf)
-- create_table(:posts, {:force=>true})
D, [2021-09-21T21:11:17.810723 #287877] DEBUG -- :    (0.5ms)  SELECT sqlite_version(*)
D, [2021-09-21T21:11:17.811032 #287877] DEBUG -- :    (0.0ms)  DROP TABLE IF EXISTS "posts"
D, [2021-09-21T21:11:17.811252 #287877] DEBUG -- :    (0.1ms)  CREATE TABLE "posts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL)
   -> 0.0037s
-- create_table(:comments, {:force=>true})
D, [2021-09-21T21:11:17.811401 #287877] DEBUG -- :    (0.0ms)  DROP TABLE IF EXISTS "comments"
D, [2021-09-21T21:11:17.811515 #287877] DEBUG -- :    (0.1ms)  CREATE TABLE "comments" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "post_id" integer)
   -> 0.0002s
D, [2021-09-21T21:11:17.825872 #287877] DEBUG -- :    (0.1ms)  CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
/home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:689:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError)
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:689:in `new'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:689:in `block in register_class_with_precision'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/type/type_map.rb:49:in `perform_fetch'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/type/type_map.rb:20:in `block in fetch'
	from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/map.rb:203:in `block in fetch_or_store'
	from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/map.rb:182:in `fetch'
	from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/map.rb:202:in `fetch_or_store'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/type/type_map.rb:19:in `fetch'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/type/type_map.rb:15:in `lookup'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb:221:in `lookup_cast_type'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:1500:in `fetch_type_metadata'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb:142:in `new_column_from_field'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:117:in `block in columns'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `map'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:116:in `columns'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:117:in `block in columns'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:116:in `fetch'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:116:in `columns'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:125:in `block in columns_hash'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:124:in `fetch'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb:124:in `columns_hash'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:568:in `load_schema!'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/attributes.rb:264:in `load_schema!'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/encryption/encryptable_record.rb:124:in `load_schema!'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:554:in `block in load_schema'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:551:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:551:in `load_schema'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:417:in `attribute_types'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/model_schema.rb:443:in `type_for_attribute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/type_caster/map.rb:16:in `type_for_attribute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/arel/table.rb:107:in `type_for_attribute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/table_metadata.rb:18:in `type'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:59:in `build'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:54:in `[]'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:126:in `block in expand_from_hash'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:79:in `each'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:79:in `flat_map'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:79:in `expand_from_hash'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/predicate_builder.rb:25:in `build_from_hash'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/query_methods.rb:1277:in `build_where_clause'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/query_methods.rb:720:in `where!'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/query_methods.rb:715:in `where'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/finder_methods.rb:81:in `find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:233:in `find_or_initialize_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:22:in `find_or_initialize_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/internal_metadata.rb:31:in `[]='
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/schema.rb:58:in `define'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/schema.rb:46:in `define'
	from active_record_main.rb:22:in `<main>'
$
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>