bootstrap-ruby / bootstrap_form

Official repository of the bootstrap_form gem, a Rails form builder that makes it super easy to create beautiful-looking forms using Bootstrap 5.
MIT License
1.64k stars 352 forks source link

Fixed `Calling << to an ActiveModel::Errors` deprecation warning #690

Closed dannytip closed 10 months ago

dannytip commented 11 months ago

Fixes #689

dannytip commented 11 months ago

This is currently failing linting due to:

Metrics/AbcSize: Assignment Branch Condition size for get_error_messages is too high. [<3, 18, 6> 19.21/18]

Any suggestion on how to resolve that @lcreid ?

lcreid commented 11 months ago

This is currently failing linting due to:

Metrics/AbcSize: Assignment Branch Condition size for get_error_messages is too high. [<3, 18, 6> 19.21/18]

Any suggestion on how to resolve that @lcreid ?

I wonder why that's come up for you? Perhaps that's why the original code used a temporary variable? For now, put # rubocop:disable Metrics/AbcSize at the start of the method, and # rubocop:enable Metrics/AbcSize at the end of the method.

dannytip commented 11 months ago

@lcreid ive added a test case which triggers the warning when you change REQUIRED_RAILS_VERSION to v6.1.7.4 strangely you don't get the warning with rails v7.0.6.

lcreid commented 10 months ago

Oops. Looks like the test fails on edge.

dannytip commented 10 months ago

Oops. Looks like the test fails on edge.

It looks like it doesn't pick up that the relationship is required in rails 7.1. Possibly something in required_association?