1

After upgrading from Rails 8.0.3 to Rails 8.1.0, my application crashes with an undefined method 'arity' for an instance of Hash error.

The issue appears to be related to the acts-as-taggable-on gem, which was automatically downgraded from version 12.0.0 to 5.0.0 during the Rails upgrade.

Environment:

Ruby: 3.4.4
Rails: 8.1.0 (upgraded from 8.0.3)
acts-as-taggable-on: 5.0.0 (downgraded from 12.0.0)
Database: MySQL2 0.5.6

Stack Trace:

/Users/macbookpro/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0/lib/active_record/associations/builder/association.rb:54:in 'ActiveRecord::Associations::Builder::Association.build_scope'
/Users/macbookpro/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0/lib/active_record/associations/builder/association.rb:48:in 'ActiveRecord::Associations::Builder::Association.create_reflection'
/Users/macbookpro/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0/lib/active_record/associations/builder/association.rb:32:in 'ActiveRecord::Associations::Builder::Association.build'
/Users/macbookpro/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/activerecord-8.1.0/lib/active_record/associations.rb:1825:in 'ActiveRecord::Associations::ClassMethods#belongs_to'
/Users/macbookpro/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/acts-as-taggable-on-5.0.0/lib/acts_as_taggable_on/tagging.rb:7:in '<class:Tagging>'
0

1 Answer 1

3

It seems this is an issue with library compatibility. acts-as-taggable-on version 12 supports ActiveRecord up to < 8.1 (Source)

gem.add_runtime_dependency 'activerecord', '>= 7.1', '< 8.1'

The reason it rolled all the way back to. 5.0 is because of bad gem specifications.

In version 5.0.0 the gemspec is

 gem.required_ruby_version     = '>= 2.2.7'
 gem.add_runtime_dependency 'activerecord', ['>= 4.2.8']

Which is satisfied by 3.4.4 and 8.1.0 but that does not mean it is functional at all. Starting with version 6.0.0 the library was much more specific about the rails versions required.

Your current options include:

  • Downgrading rails to < 8.1

As of about 11 hours ago it does appear they are testing master against 8.1 so maybe check with the maintainers as to when this will be available as a release.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah I found this PR, They are working on the support with rails 8.1 github.com/mbleigh/acts-as-taggable-on/issues/1159

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.