Module: ValidatableAssociations::MassAssignment

Included in:
ValidatableAssociations
Defined in:
lib/validatable_associations/mass_assignment.rb

Instance Method Summary collapse

Instance Method Details

#initialize(attributes = {}) ⇒ Object

The initialize method handles mass-assignment of a given Hash of attributes to their instance variables.



6
7
8
9
# File 'lib/validatable_associations/mass_assignment.rb', line 6

def initialize(attributes = {})
  return if !attributes || attributes.empty?
  attributes.each { |ivar, value| assign_to(ivar, value) }
end