servactory 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff122141adf96c61aac5e2c89b9ca1ea0644ec4a9e106737e114108adbf06e17
4
- data.tar.gz: 04d8ab68d2ce909e7b2ab9b92e3c4cd0c356385b87fd6f1b17040d16b22f9c43
3
+ metadata.gz: 16aa240b4c12f35c6cf2c43e1c5d56bdd39e19d40321ad3f66ac0bdd6ebcf110
4
+ data.tar.gz: ad3418afd34e75c869424708dd080c27b192b6ffdc6770485e74fa70047a6620
5
5
  SHA512:
6
- metadata.gz: 3eea6b5733b7a80ceeac63a5fd9e16492367da3d3bd3ffbbdda343791578a788388eb1b77873595fc710d7ca0a62985a971d2e1ba02d1048b35dede880ce63e6
7
- data.tar.gz: 35a1dee0a933768875c583678019c6f62cecc4b05fe7ffaf000edd3a01596a6dba18fa0111cce3b876013994e492b91e05062e7690a01ebfdd9b3f415325e3b6
6
+ metadata.gz: 472eb5c2643cdb648e57ae8586e6a06795da73b90f7b0a2fcac30c43f02c932ba897f01fe0707707846b93b8131d4f16d7d0b143b4e3e08988dc7e5891cbaca3
7
+ data.tar.gz: e25034c6b2d4c166e27c9db570db16e1436ff7cca39de6a9cb8ce6a8754f835968c2afe21b9ee287a31661e3801715503a78c09294974cabd893da07137c8f1a
data/README.md CHANGED
@@ -43,7 +43,7 @@ class SessionsController < ApplicationController
43
43
  session[:current_user_id] = service_result.user.id
44
44
  redirect_to service_result.user
45
45
  else
46
- flash.now[:message] = service_result.errors.first.message
46
+ flash.now[:message] = service_result.error.message
47
47
  render :new
48
48
  end
49
49
  end
@@ -22,6 +22,10 @@ module Servactory
22
22
  @errors ||= Servactory::Errors::Collection.new
23
23
  end
24
24
 
25
+ def error
26
+ errors.first
27
+ end
28
+
25
29
  def raise_first_fail
26
30
  return if (tmp_errors = errors.for_fails.not_blank).empty?
27
31
 
@@ -25,6 +25,7 @@ module Servactory
25
25
 
26
26
  def prepare_statuses_with(context:)
27
27
  define_singleton_method(:errors) { context.errors }
28
+ define_singleton_method(:error) { context.error }
28
29
  define_singleton_method(:success?) { context.errors.empty? }
29
30
  define_singleton_method(:failure?) { !context.errors.empty? }
30
31
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 7
7
- PATCH = 0
7
+ PATCH = 1
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-17 00:00:00.000000000 Z
11
+ date: 2023-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport