Skip to content

"Unsupported number of args for ActiveRecord::ConnectionAdapters::TableDefinition.new() (ArgumentError)" #73

@fredngo

Description

@fredngo

When trying to use MiniRecord with Rails 5 ActiveRecord, we get this error:

/Users/fred/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_record-0.4.7/lib/mini_record/auto_schema.rb:22:in `init_table_definition': Unsupported number of args for ActiveRecord::ConnectionAdapters::TableDefinition.new() (ArgumentError)
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_record-0.4.7/lib/mini_record/auto_schema.rb:35:in `table_definition'
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_record-0.4.7/lib/mini_record/auto_schema.rb:121:in `block in field'
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_record-0.4.7/lib/mini_record/auto_schema.rb:111:in `each'
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mini_record-0.4.7/lib/mini_record/auto_schema.rb:111:in `field'
    from /Users/fred/dev/work/bitmaker/wdi-august-2016/11-intro-to-databases/film.rb:7:in `<class:Film>'
    from /Users/fred/dev/work/bitmaker/wdi-august-2016/11-intro-to-databases/film.rb:6:in `<top (required)>'
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/fred/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from server.rb:1:in `<main>'

This error comes from the init_table_definition class method in the MiniRecord::AutoSchema module.

It looks like Rails 5 changed the number of arguments in ActiveRecord::ConnectionAdapters::TableDefinition#initialize!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions