snfoil 0.5.5 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 272fc63879df9b9d3e112dcc8e73638a85a1a75f2faab91530e20fb888cf6c80
4
- data.tar.gz: 6e5994391f96c17b4016f55e2c52c1cb1fff935c6dfdb05d20572e0232bdbd6b
3
+ metadata.gz: cfab0f49425b4cd1ba02f48f0c3bc114e45fd061118d9673740f2ec05b7655e2
4
+ data.tar.gz: 9c66aac6b0edf869f8243db1c447c5e0ef4df1162734c086dfe26fde86427e74
5
5
  SHA512:
6
- metadata.gz: 90fc1492c594aabe7dc780fc341c3e3fb3d12a7c264b6e85fb08c3bfebd45a69d2cd87a0903e02c979e43c6909f7e5a9c32c39d8cc5f66edf2af541b2182dba6
7
- data.tar.gz: 1f08ef48c2509a37f25016d9d5ca2e2e0b34bd828180d16e46f42715820690a0ee950e55c869079209f2fe604ab8f6671ddccb7fd1a8cc8592d330bbf0b33bda
6
+ metadata.gz: 239615bc72acaa404521d0771fddaf05a7489cbbf7d9f8b5f1ba8e271c4cb520a2146bdeaf153e933c1c34d83b662a72ebe41f2fd3162825bbd52615fa6b5d8d
7
+ data.tar.gz: b4ac4f458812bfce5002e30103f35a30fc44a8509c3ec3cfb8fa86e612d2fa6f48ada5b34713c29e4910ae321477fbc9bfffdc4e47468121424523f33ba8c3db
@@ -70,7 +70,7 @@ module SnFoil
70
70
  options = setup_create_object(**options)
71
71
  authorize(options[:object], :create?, **options)
72
72
  options = create_hooks(**options)
73
- unwrap_object(options[:object])
73
+ options[:object]
74
74
  end
75
75
 
76
76
  def setup_create(**options)
@@ -127,7 +127,9 @@ module SnFoil
127
127
  # This method is private to help protect the order of execution of hooks
128
128
  def create_hooks(options)
129
129
  options = before_create_save(**options)
130
- options = if options[:object].save
130
+ save_successful = options[:object].save
131
+ options.merge!(object: unwrap_object(options[:object]))
132
+ options = if save_successful
131
133
  after_create_save_success(**options)
132
134
  else
133
135
  after_create_save_failure(**options)
@@ -121,7 +121,9 @@ module SnFoil
121
121
  # This method is private to help protect the order of execution of hooks
122
122
  def destroy_hooks(options)
123
123
  options = before_destroy_save(options)
124
- options = if options[:object].destroy
124
+ destroy_successful = options[:object].destroy
125
+ options.merge!(object: unwrap_object(options[:object]))
126
+ options = if destroy_successful
125
127
  after_destroy_save_success(options)
126
128
  else
127
129
  after_destroy_save_failure(options)
@@ -124,7 +124,9 @@ module SnFoil
124
124
  # This method is private to help protect the order of execution of hooks
125
125
  def update_hooks(options)
126
126
  options = before_update_save(options)
127
- options = if options[:object].save
127
+ update_successful = options[:object].save
128
+ options.merge!(object: unwrap_object(options[:object]))
129
+ options = if update_successful
128
130
  after_update_save_success(options)
129
131
  else
130
132
  after_update_save_failure(options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SnFoil
4
- VERSION = '0.5.5'
4
+ VERSION = '0.6'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-21 00:00:00.000000000 Z
12
+ date: 2020-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport