Created
April 29, 2010 13:50
-
-
Save c7/383630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Handle the data structures | |
[ | |
['distributionevent', 'distribution_events', DistributionEvent], | |
['storage', 'storages', Storage] | |
].each do |name, accessor, structure_class| | |
data = product_data[name] | |
self.send("#{accessor}=", (!data.nil? && data.size > 0) ? | |
data.map { |d| structure_class.new d } : []) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment