Skip to content

Commit

Permalink
Fix SalesforceOrm::Object caching issue (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalvijay committed Dec 26, 2017
1 parent d02c0d4 commit 60e0a30
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
salesforce-orm (1.2.3)
salesforce-orm (1.2.4)
activerecord (~> 3)
activerecord-nulldb-adapter (~> 0)
restforce (~> 2.5)
Expand All @@ -25,15 +25,17 @@ GEM
arel (3.0.3)
builder (3.0.4)
byebug (9.0.5)
concurrent-ruby (1.0.5)
diff-lcs (1.3)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
hashie (3.5.6)
i18n (0.8.6)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
json (2.1.0)
multi_json (1.12.1)
multi_json (1.12.2)
multipart-post (2.0.0)
rake (10.4.2)
restforce (2.5.3)
Expand Down
11 changes: 11 additions & 0 deletions lib/salesforce-orm/object_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,15 @@ def inspect
to_h
end
end

# Fix for unable to cache object of this class.
# This is a temporary solution. Once Restforce::Mash fix this issue, we'll revert this change
# WARNING: As of now, you can't do any restforce operation on the object of this class which is fetched from cache
def marshal_dump
h = to_h
h[:attributes] = Restforce::Mash.new(attributes.to_h) if attributes
h[:original_object] = Restforce::SObject.new(original_object.to_h) if original_object
h[:original_object][:attributes] = Restforce::Mash.new(original_object.attributes.to_h) if original_object && original_object.attributes
h
end
end
2 changes: 1 addition & 1 deletion lib/salesforce-orm/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SalesforceOrm
VERSION = '1.2.3'.freeze
VERSION = '1.2.4'.freeze
end

0 comments on commit 60e0a30

Please sign in to comment.