From fc6875fea831af04bb2a3445a8051293e9cf4148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Thu, 1 Apr 2021 17:57:40 -0300 Subject: [PATCH 1/4] Bump sqlite3 version --- jsonapi-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi-rails.gemspec b/jsonapi-rails.gemspec index 48387d4..38af514 100644 --- a/jsonapi-rails.gemspec +++ b/jsonapi-rails.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'jsonapi-parser', '~> 0.1.0' spec.add_development_dependency 'rails', '~> 5.0' - spec.add_development_dependency 'sqlite3', '~> 1.3.6' + spec.add_development_dependency 'sqlite3', '~> 1.4' spec.add_development_dependency 'rake', '~> 11.3' spec.add_development_dependency 'rspec-rails', '~> 3.5' spec.add_development_dependency 'with_model', '~> 2.0' From 03501a0f88e3ad6aa076f4d9c595cc017b87f804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Thu, 1 Apr 2021 17:58:29 -0300 Subject: [PATCH 2/4] Use active record error attribute_names intead errors.keys if available --- lib/jsonapi/rails/serializable_active_model_errors.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/jsonapi/rails/serializable_active_model_errors.rb b/lib/jsonapi/rails/serializable_active_model_errors.rb index a97ec71..86d2b15 100644 --- a/lib/jsonapi/rails/serializable_active_model_errors.rb +++ b/lib/jsonapi/rails/serializable_active_model_errors.rb @@ -25,7 +25,7 @@ def initialize(exposures) end def as_jsonapi - @errors.keys.flat_map do |key| + error_keys.flat_map do |key| @errors.full_messages_for(key).map do |message| SerializableActiveModelError.new(field: key, message: message, pointer: @reverse_mapping[key]) @@ -33,6 +33,12 @@ def as_jsonapi end end end + + private + + def error_keys + @errors.respond_to?(:attribute_names) ? @errors.attribute_names : @errors.keys + end end end end From e59c7f8a36f761a58a5c7e9baaf0db2378600022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Thu, 1 Apr 2021 17:59:37 -0300 Subject: [PATCH 3/4] Bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1d0ba9e..267577d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0 +0.4.1 From e1af978954179a39226af44b24535fa1315eb8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Thu, 1 Apr 2021 19:01:18 -0300 Subject: [PATCH 4/4] Relax sqlite dependency --- jsonapi-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi-rails.gemspec b/jsonapi-rails.gemspec index 38af514..d0bdbb4 100644 --- a/jsonapi-rails.gemspec +++ b/jsonapi-rails.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'jsonapi-parser', '~> 0.1.0' spec.add_development_dependency 'rails', '~> 5.0' - spec.add_development_dependency 'sqlite3', '~> 1.4' + spec.add_development_dependency 'sqlite3', '~> 1.3' spec.add_development_dependency 'rake', '~> 11.3' spec.add_development_dependency 'rspec-rails', '~> 3.5' spec.add_development_dependency 'with_model', '~> 2.0'