Skip to content

Commit

Permalink
Modified method handling in deserializing ActiveRecord objects so tha…
Browse files Browse the repository at this point in the history
…t method attributes can be set.
  • Loading branch information
fosrias authored and Victor Castell committed May 15, 2010
1 parent c13b009 commit 6510b6e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions util/vo_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,15 @@ def self.finalize_object(obj)
obj.instance_variable_set("@changed_attributes", {}) # fosrias: only set changed attributes for existing records
end
# process @methods hash
if @methods and @methods[obj.class.name]
@methods[obj.class.name].each do |key, value|
if @methods
@methods.delete(obj.class.name).each do |key, value|
obj.send("#{key}=", value)
end if @methods[obj.class.name]

# fosrias: Process method related attributes passed back if they have a setter defined
# Allows setting attr_accessors as methods on ActiveRecord objects.
@methods.each do |key, value|
obj.send("#{key}=", value) if obj.respond_to?("#{key}=")
end
end
end
Expand Down

0 comments on commit 6510b6e

Please sign in to comment.