Skip to content

Commit

Permalink
Merge branch 'rails-6-1' of https://github.com/tomasdundacek/active_i…
Browse files Browse the repository at this point in the history
…nteraction into v4.0.0
  • Loading branch information
AaronLasseigne committed Jan 10, 2021
2 parents fd76cdf + c7774d9 commit f97e64f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
ruby: ["2.7"]
activemodel: ["6.0", "5.2", "5.1", "5.0"]
activemodel: ["6.1", "6.0", "5.2", "5.1", "5.0"]

steps:
- uses: actions/checkout@v2
Expand Down
9 changes: 9 additions & 0 deletions gemfiles/activemodel-6.1.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'activemodel', '~> 6.1.0'
gem 'activerecord', '~> 6.1.0'
unless defined?(JRUBY_VERSION) # rubocop:disable Style/IfUnlessModifier
gem 'sqlite3', '~> 1.4.1'
end
5 changes: 3 additions & 2 deletions lib/active_interaction/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ def merge_detail!(attribute, detail, message)
if attribute?(attribute) || attribute == :base
options = detail.dup
error = options.delete(:error)
options[:message] = message

add(attribute, error, options) unless added?(attribute, error, options)
unless added?(attribute, error, options)
add(attribute, error, options.merge(message: message))
end
else
merge_message!(attribute, message)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/active_interaction/errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class B < ActiveRecord::Base

it 'merges the nested errors' do
a.valid?
expect(a.errors.messages).to eql('b.name': ["can't be blank"])
expect(a.errors.messages).to eq('b.name': ["can't be blank"])
expect(a.errors.size).to eql 1
expect { errors.merge!(a.errors) }.to_not raise_error
expect(errors.size).to eql 1
Expand Down

0 comments on commit f97e64f

Please sign in to comment.