Method: ActionController::Base#instantiate_array_from_hashes

Defined in:
app/controllers/rails_ext.rb

#instantiate_array_from_hashes(class_name_2_attr_hash_hash) ⇒ Object

Instantiates an Array of object from class_name_2_attr_hash_hash which should be a hash where the keys are class names and the values a Hash containing => attr_value pairs.



8
9
10
11
12
13
14
# File 'app/controllers/rails_ext.rb', line 8

def instantiate_array_from_hashes(class_name_2_attr_hash_hash)
  result = []
  class_name_2_attr_hash_hash.each do |class_name, attr_hash|
    result << instantiate_from_hash(eval(class_name), attr_hash)
  end
  result
end