uncouple 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 8b8258d3acabe57af68da9c30a1df945dc11c8fb
4
- data.tar.gz: 93805d726a1602697a3d1e9bc879c2ddfe6d93d0
3
+ metadata.gz: deab97431c62e5ef08f4c099ad2ac6d3c1b2950f
4
+ data.tar.gz: 7205fba6acf8f06d193ec5f6f1149ba4aa8b0bc7
5
5
  SHA512:
6
- metadata.gz: 36d8cd6f56f95227a3fde0457495a133718b42f036f4f9ab93907be6a19f1516014f622184900b49c5ccaf242b3fc1aee30032863f2d088f4207d0419799d2c0
7
- data.tar.gz: 1ee955b4721fd90040b72eae1eaa975cceb6f4b80438b2e30d4986d37b61a16c1e7569aa3b11341a9c33603b64f47f538dd59485f062da1400a3d81545b10f36
6
+ metadata.gz: f009497230256ca2c63ae05dcd4dfc20b4880965af8bb29204a222002c8438253fbf58a04fc8852c512f5eb638d71097eb95b4e061bac4c4e8555c38855cc446
7
+ data.tar.gz: 153b886ece82091269883384ad5f0b30aac3a5d7d322ef38c4796cfa30b8ab764bd75b75242cc2c158d284534c026d68c511678c9c24e5fa596cfb19db7a111f
@@ -3,7 +3,7 @@ module Uncouple
3
3
 
4
4
  def perform(action_class, action_params=nil, &block)
5
5
  action_params ||= params if respond_to?(:params)
6
- action_params.merge!(current_user: current_user) if respond_to?(:current_user)
6
+ action_params = params_with_current_user(action_params)
7
7
  if @action = action_class.new(action_params)
8
8
  @action.perform_with_authorization
9
9
  block.call if block_given? && @action.success?
@@ -11,5 +11,10 @@ module Uncouple
11
11
  @action
12
12
  end
13
13
 
14
+ def params_with_current_user(params)
15
+ return params if params.nil? || !respond_to?(:current_user)
16
+ params.merge(current_user: current_user)
17
+ end
18
+
14
19
  end
15
20
  end
@@ -1,3 +1,3 @@
1
1
  module Uncouple
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uncouple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spencer Steffen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler