object_attorney 0.0.9 → 0.0.10

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.
@@ -87,10 +87,10 @@ module ObjectAttorney
87
87
  module ClassMethods
88
88
 
89
89
  def represents(represented_object, represented_object_class = nil)
90
- represented_object_class ||= represented_object.to_s.camelize
90
+ represented_object_class ||= represented_object.to_s.camelize.constantize
91
91
 
92
92
  define_method(represented_object) do
93
- @represented_object ||= represented_object_class.constantize.new
93
+ @represented_object ||= represented_object_class.new
94
94
  end
95
95
  end
96
96
 
@@ -20,11 +20,12 @@ module ObjectAttorney
20
20
  end
21
21
 
22
22
  def rollback(options = {})
23
+ return true if @represented_object.blank?
23
24
  @represented_object.rollback(options)
24
25
  end
25
26
 
26
27
  def call_save_or_destroy(object, save_method, options = {})
27
- if object == self
28
+ if object == self || object == @represented_object
28
29
  @represented_object.present? ? evoke_method_on_object(@represented_object, save_method, options) : true
29
30
  else
30
31
  save_method = :destroy if check_if_marked_for_destruction?(object)
@@ -1,3 +1,3 @@
1
1
  module ObjectAttorney
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: object_attorney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-09 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler