mm_partial_update 0.1.5 → 0.1.6

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.
@@ -64,10 +64,11 @@ module MmPartialUpdate
64
64
  field_changes = persistable_changes
65
65
 
66
66
  associations.values.each do |association|
67
- proxy = get_proxy(association)
68
- association_changes = field_changes.delete(association.name)
69
- proxy.add_updates_to_command(association_changes, command) if
70
- proxy.respond_to?(:add_updates_to_command)
67
+ if proxy = self.instance_variable_get(association.ivar)
68
+ association_changes = field_changes.delete(association.name)
69
+ proxy.add_updates_to_command(association_changes, command) if
70
+ proxy.respond_to?(:add_updates_to_command)
71
+ end
71
72
  end
72
73
 
73
74
  field_changes = field_changes.inject({}) do |changes,change|
@@ -106,23 +107,24 @@ module MmPartialUpdate
106
107
  @_new = false
107
108
  clear_changes
108
109
  associations.each do |_, association|
109
- proxy = get_proxy(association)
110
- proxy.save_to_collection(options) if
111
- proxy.proxy_respond_to?(:save_to_collection)
110
+ if proxy = self.instance_variable_get(association.ivar)
111
+ proxy.save_to_collection(options) if
112
+ proxy.proxy_respond_to?(:save_to_collection)
113
+ end
112
114
  end
113
115
  end
114
116
 
115
117
  def execute_command(update_command,options)
116
- if options[:callbacks]
117
- context = new? ? :create : :update
118
- run_callbacks(:save) do
118
+ if options[:callbacks]
119
+ context = new? ? :create : :update
120
+ run_callbacks(:save) do
119
121
  run_callbacks(context) do
120
122
  update_command.execute()
121
123
  end
122
124
  end
123
125
  else
124
126
  update_command.execute()
125
- end
127
+ end
126
128
  end
127
129
 
128
130
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module MmPartialUpdate
3
- Version = '0.1.5'
3
+ Version = '0.1.6'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm_partial_update
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Stults
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-08 00:00:00 -08:00
18
+ date: 2011-01-11 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency