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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5130538c6b44a430d5a7c1607fbb8939247d95
|
4
|
+
data.tar.gz: 7ccd73b6517418ec72b3d1f0204e95e4b01619c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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:
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|