epom_rails 0.4.8 → 0.4.9

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: c9086f2e7afed647692d0bbb953e3cdc4e4fa10a
4
- data.tar.gz: 55c358f0ef70b8d3d533469ae7bcc7773ffeb90a
3
+ metadata.gz: 9487c632ee64b76623635a73c7ea0fa1ebc24142
4
+ data.tar.gz: 91b9485e01854440b99cbe9f7a029588f58ec1c6
5
5
  SHA512:
6
- metadata.gz: fc81a0b198c2c8fef6effdcd0fecbc1318da22295e86e201ac0e3f3aa31ae1e616b3cf6a634dba2dd593c9224227859e744ad8e59f06e0ec083d238613f7800d
7
- data.tar.gz: bcd1eb4be831e8d578d23e122c1c772e54eb20960bf3d6908acaa35fc5cfccf1b2ea2b3fde438ed9b2232a9777ff518592604f3325eacd201e57040f9bda9fb8
6
+ metadata.gz: ce6449077d706236c930d7566723159184ce90c42ff81ead03d8dfa94e8432f0afd8f63f1ed4ce4861640a442a7062f40994244ceabc02257bc0e7fe64ef01d4
7
+ data.tar.gz: 44efb423e734bd84f3f4ba87585af8bdfff2f5c9a70f59f24095315d77e3b9e284f031de862d3dd16d363cbb89c5cc87de4db455ff522a96c620f6770413085f
@@ -46,15 +46,21 @@ class ActiveRecord::Base
46
46
  method = if self.send fields.key('id') then "update_#{klass_name.downcase}" else "create_#{klass_name.downcase}" end
47
47
 
48
48
  url_params = {}
49
- if klass.extended_methods[method.to_sym][:url_parameters]
50
- klass.extended_methods[method.to_sym][:url_parameters].each do |parameter|
49
+ url_parameters = klass.extended_methods[method.to_sym][:url_parameters]
50
+ if url_parameters
51
+ url_parameters.each do |parameter|
51
52
  url_params[parameter] = self.send(fields.key(parameter.to_s)) if fields.key(parameter.to_s)
52
53
  end
53
54
  end
55
+ # if campaignId, bannerId, etc, as url parameters in update action
56
+ if url_parameters and url_parameters.include? "#{klass_name.downcase}Id".to_sym
57
+ url_params["#{klass_name.downcase}Id".to_sym] = self.send "#{fields.key('id')}"
58
+ end
54
59
 
55
60
  body_params = {}
56
- if klass.extended_methods[method.to_sym][:body_parameters]
57
- klass.extended_methods[method.to_sym][:body_parameters].each do |parameter|
61
+ body_parameters = klass.extended_methods[method.to_sym][:body_parameters]
62
+ if body_parameters
63
+ body_parameters.each do |parameter|
58
64
  body_params[parameter] = self.send(fields.key(parameter.to_s)) if fields.key(parameter.to_s)
59
65
  end
60
66
  end
@@ -1,3 +1,3 @@
1
1
  module EpomRails
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epom_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Chang