Skip to content

Instantly share code, notes, and snippets.

@inem
Created April 12, 2009 12:56
Show Gist options
  • Save inem/93986 to your computer and use it in GitHub Desktop.
Save inem/93986 to your computer and use it in GitHub Desktop.
serialization.rb patch
7a8
> @methods_params_hash = {}
29a31,37
> def methods_with_params
> Array(options[:methods]).inject({}) do |method_attributes, method_array|
> method_attributes.merge!(method_array) if method_array.is_a?(Hash)
> method_attributes
> end
> end
>
31c39,44
< Array(options[:methods]).inject([]) do |method_attributes, name|
---
> Array(options[:methods]).inject([]) do |method_attributes, method_array|
> if method_array.is_a?(Hash)
> name = Array(method_array).first.first
> else
> name = method_array
> end
75c88,94
< serializable_names.each { |name| serializable_record[name] = @record.send(name) }
---
> serializable_names.each do |name|
> if(params = methods_with_params[name])
> serializable_record[name] = @record.send(name, *(params))
> else
> serializable_record[name] = @record.send(name)
> end
> end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment