rails-add_ons 2.2.0 → 2.2.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
  SHA1:
3
- metadata.gz: 8bcd8208bf74f48898936baa02d21720ba62ccf8
4
- data.tar.gz: c7225749ed3871555682fa94e556394b392d6d9b
3
+ metadata.gz: 1c7c4f39bddae1458684c318b7c5eb56192a5807
4
+ data.tar.gz: 837bb68a45e06765a53361094424189022aac308
5
5
  SHA512:
6
- metadata.gz: 0a287305c63b7cb4bb325c91ec7daa497f29adf5a3a6ae67ab79ed7381614ae20c593616a8c1830bf0055628fe9d8f65e84fa322aead5c412523fe5339bd2769
7
- data.tar.gz: 966da1755681d98edcb0ca1445a6579fa210dd3dc9f82c5e5a304184be8b864f2b31163d81340c31e84a307461dca9388ed06182801f6d7eee0a28ad184bf6a2
6
+ metadata.gz: 0b3ea72bef606239b4f36ef3a3f968cade7414a163fed52b017065206141ccef0bb73a00db0cc66dbd9cc37259425e97834e50702e34f67e40b15c353226c5e6
7
+ data.tar.gz: 1e719c48c0dfece1b0a28c9cbfe0b2084b70527a551a3c16f20b0b58aa10b47e4ab307c80447fc38b04ca3cb5c129c772cf0678b7ee75c0eff854f2088432b1d
@@ -27,13 +27,7 @@ module ResourcesController
27
27
  def edit; end
28
28
 
29
29
  def update
30
- if Rails::VERSION::MAJOR < 4
31
- @resource.update_attributes(permitted_params)
32
- else
33
- @resource.update(permitted_params)
34
- end
35
-
36
- if respond_to?(:after_update_location, true)
30
+ if @resource.send(update_method_name, permitted_params) && respond_to?(:after_update_location, true)
37
31
  respond_with(respond_with_namespace, @resource, location: after_update_location)
38
32
  else
39
33
  respond_with(respond_with_namespace, @resource)
@@ -50,8 +44,7 @@ module ResourcesController
50
44
  end
51
45
 
52
46
  def create
53
- @resource.save
54
- if respond_to?(:after_create_location, true)
47
+ if @resource.save && respond_to?(:after_create_location, true)
55
48
  respond_with(respond_with_namespace, @resource, location: after_create_location)
56
49
  else
57
50
  respond_with(respond_with_namespace, @resource)
@@ -60,6 +53,10 @@ module ResourcesController
60
53
 
61
54
  private
62
55
 
56
+ def update_method_name
57
+ Rails::VERSION::MAJOR < 4 ? :update_attributes : :update
58
+ end
59
+
63
60
  def respond_with_namespace
64
61
  nil
65
62
  end
@@ -1,5 +1,5 @@
1
1
  module Rails
2
2
  module AddOns
3
- VERSION = '2.2.0'.freeze
3
+ VERSION = '2.2.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-add_ons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-24 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails