Method: EmbedsMany::Child#initialize

Defined in:
lib/embeds_many/child.rb

#initialize(attrs = {}) ⇒ Child

Returns a new instance of Child.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/embeds_many/child.rb', line 36

def initialize(attrs={})
  @attributes = ActiveSupport::HashWithIndifferentAccess.new

  attrs.each do |name, value|
    if respond_to? "#{name}="
      send("#{name}=", value)
    else
      @attributes[name] = value
    end
  end
end