Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using AF 14 with Rails 6.1 #1492

Open
cjcolvar opened this issue Feb 8, 2023 · 0 comments
Open

Error using AF 14 with Rails 6.1 #1492

cjcolvar opened this issue Feb 8, 2023 · 0 comments

Comments

@cjcolvar
Copy link
Member

cjcolvar commented Feb 8, 2023

When running Avalon's test suite I'm seeing the following error:

          FrozenError:
            can't modify frozen Array: ["field is required."]
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:249:in `block in association_valid?'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:246:in `association_valid?'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:233:in `block in validate_collection_association'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:233:in `each'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:233:in `validate_collection_association'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:147:in `block in define_autosave_association_callbacks'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:105:in `instance_eval'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/autosave_association.rb:105:in `block in define_non_cyclic_method'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/validations.rb:100:in `block in run_validations!'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/validations.rb:100:in `run_validations!'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/validations.rb:69:in `valid?'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/validations.rb:93:in `perform_validations'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/validations.rb:50:in `save'
          # /usr/local/bundle/gems/active-fedora-14.0.0/lib/active_fedora/associations/builder/orders.rb:44:in `save'
          # ./app/models/master_file.rb:248:in `media_object='

I think this could be resolved by avoiding modification of the frozen array by using += instead of << and .uniq instead of .uniq! on

errors[attribute] << message
errors[attribute].uniq!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant