effective_resources 0.7.5 → 0.7.6

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
  SHA1:
3
- metadata.gz: 2b7ea13c4da05e3fbac7d0b7d86865529af893cd
4
- data.tar.gz: dccdd1e341a27700e93dcbf4f951c1207d514990
3
+ metadata.gz: 4a5130538c6b44a430d5a7c1607fbb8939247d95
4
+ data.tar.gz: 7ccd73b6517418ec72b3d1f0204e95e4b01619c6
5
5
  SHA512:
6
- metadata.gz: 0b6adb87dafcdb775a71850fe8015a6b110b9c52157db64e7e65fac12cfa1f7fd6a908d1b87094b1967329bbdb1235f0a0f2561f85d0ce3bd8d9e49a1ddb158f
7
- data.tar.gz: e25c5f12ed3d2ca3bbef12ea2e4c7292f1df0f7c18de31072532ed6f7b376eccf286bd1fd64548087823fce471cfcf3405332b4ec40d9d41eff4e8cf8aa17e75
6
+ metadata.gz: 063e75b4d918a0cc8d03f202e5801233ec3cbaf47da349967083eaa6c8728e6c4c833462448d103f406bc7d0dedfeabe6e9ab51c8ca26bc00bca937223151bd8
7
+ data.tar.gz: 4c62c7af4793ce77f42147478b9083867a2f484e785abcea7c9c95e84199bfe1ff10af2e2194069af83fd98c671d1424ac7cf66e1e205e8ae67cedf8656cc637
@@ -290,11 +290,6 @@ module Effective
290
290
  render json: { status: 200, message: "Successfully #{action_verb(action)} #{successes} / #{resources.length} selected #{resource_plural_name}" }
291
291
  end
292
292
 
293
-
294
-
295
- # The block must implement a comparison between a and b and return an integer
296
- # less than 0 when b follows a, 0 when a and b are equivalent, or an integer greater than 0 when a follows b.
297
-
298
293
  # Here we look at all available (class level) member actions, see which ones apply to the current resource
299
294
  # This feeds into the helper simple_form_submit(f)
300
295
  # Returns a Hash of {'Save': {data-disable-with: 'Saving...'}, 'Approve': {data-disable-with: 'Approve'}}
@@ -324,7 +319,7 @@ module Effective
324
319
  protected
325
320
 
326
321
  # This calls the appropriate member action, probably save!, on the resource.
327
- def save_resource(resource, action = :save)
322
+ def save_resource(resource, action = :save, &block)
328
323
  raise "expected @#{resource_name} to respond to #{action}!" unless resource.respond_to?("#{action}!")
329
324
 
330
325
  resource.current_user ||= current_user if resource.respond_to?(:current_user=)
@@ -332,6 +327,7 @@ module Effective
332
327
  resource_klass.transaction do
333
328
  begin
334
329
  resource.public_send("#{action}!") || raise("failed to #{action} #{resource}")
330
+ yield if block_given?
335
331
  run_callbacks(:resource_save)
336
332
  return true
337
333
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '0.7.5'.freeze
2
+ VERSION = '0.7.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails