Throws error when using composite primary keys (supported natively by rails 7.1)
Opened this issue · 1 comments
mintuhouse commented
Unable to annotate app/models/user_login_change_key.rb: comparison of Array with Array failed
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:367:in `sort_by'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:367:in `get_foreign_key_info'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:203:in `get_schema_info'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:539:in `annotate'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:740:in `annotate_model_file'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:716:in `block in do_annotations'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:715:in `each'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:715:in `do_annotations'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/bin/annotate:31:in `<top (required)>'
/bundle/ruby/3.2.0/bin/annotate:25:in `load'
/bundle/ruby/3.2.0/bin/annotate:25:in `<top (required)>'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
/railsapi/bin/bundle:108:in `load'
/railsapi/bin/bundle:108:in `<main>'
Unable to annotate app/models/user_login_change_key.rb: no implicit conversion of nil into Array
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:740:in `concat'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:740:in `annotate_model_file'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:716:in `block in do_annotations'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:715:in `each'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/lib/annotate/annotate_models.rb:715:in `do_annotations'
/bundle/ruby/3.2.0/bundler/gems/annotate_models-e60a66644e8a/bin/annotate:31:in `<top (required)>'
/bundle/ruby/3.2.0/bin/annotate:25:in `load'
/bundle/ruby/3.2.0/bin/annotate:25:in `<top (required)>'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/bundle/ruby/3.2.0/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
/railsapi/bin/bundle:108:in `load'
/railsapi/bin/bundle:108:in `<main>'
Version
- annotate version: develop branch
- rails version: 7.1.0.rc1
- ruby version: 3.2.0
mintuhouse commented
Options to fix
- Change
show_complete_foreign_keys
totrue
OR - Change this line from
foreign_keys.sort_by {|fk| [format_name.call(fk), fk.column]}.each do |fk|
toforeign_keys.sort_by {|fk| [format_name.call(fk), *fk.column]}.each do |fk|