diff --git a/active_presenter.gemspec b/active_presenter.gemspec index f5f2588..54499bf 100644 --- a/active_presenter.gemspec +++ b/active_presenter.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| 'test/lint_test.rb', 'test/test_helper.rb' ] - s.add_runtime_dependency('activerecord', ['>= 3.2', '< 7.0']) + s.add_runtime_dependency('activerecord', ['>= 3.2', '< 8.0']) s.add_development_dependency('rake', ['>= 12.0']) s.add_development_dependency('rspec', ['>= 3.0.0']) s.add_development_dependency('sqlite3', ['>= 1.3.5']) diff --git a/lib/active_presenter/base.rb b/lib/active_presenter/base.rb index 3ed9543..11d2ff5 100644 --- a/lib/active_presenter/base.rb +++ b/lib/active_presenter/base.rb @@ -264,11 +264,11 @@ def attribute_prefix(type) end def merge_errors(presented_inst, type) - presented_inst.errors.each do |att,msg| - if att == :base - errors.add(type, msg) + presented_inst.errors.each do |error| + if error.attribute == :base + errors.add(type, error.message) else - errors.add(attribute_prefix(type)+att.to_s, msg) + errors.add(attribute_prefix(type) + error.attribute.to_s, error.message) end end end