From 68eb523595f5de6f90054195b038fd838e81ce06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Mon, 1 Aug 2016 22:16:11 +0100 Subject: [PATCH] validator class should run even without a target --- Gemfile.lock | 4 ++-- lib/rest_my_case/validator.rb | 2 ++ lib/rest_my_case/version.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2535521..99bf685 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rest_my_case (2.0.2) + rest_my_case (2.0.3) object_attorney (>= 3.0.6) GEM @@ -24,7 +24,7 @@ GEM json (1.8.3) method_source (0.8.2) multi_json (1.12.1) - object_attorney (3.0.6) + object_attorney (3.0.7) activemodel (>= 3.0.0) parser (2.3.0.6) ast (~> 2.2) diff --git a/lib/rest_my_case/validator.rb b/lib/rest_my_case/validator.rb index c37ed34..3c8b365 100644 --- a/lib/rest_my_case/validator.rb +++ b/lib/rest_my_case/validator.rb @@ -19,6 +19,8 @@ def self.target(name, options = {}) self.silence_dependencies_abort = true def perform + return if defendant_options.empty? + error('unprocessable_entity') if invalid? end end diff --git a/lib/rest_my_case/version.rb b/lib/rest_my_case/version.rb index 6b6a287..cda5da2 100644 --- a/lib/rest_my_case/version.rb +++ b/lib/rest_my_case/version.rb @@ -1,3 +1,3 @@ module RestMyCase - VERSION = '2.0.2'.freeze + VERSION = '2.0.3'.freeze end