Skip to content

Instantly share code, notes, and snippets.

@irmiller22
Created October 10, 2013 14:17
Show Gist options
  • Save irmiller22/6919108 to your computer and use it in GitHub Desktop.
Save irmiller22/6919108 to your computer and use it in GitHub Desktop.
Mass-Assign at Initialization
class Person
attr_accessor :name, :birthday, :hair_color, :eye_color, :height,:weight,:handed,:complexion,:t_shirt_size,:wrist_size,:glove_size, :pant_length,:pant_width
def initialize(attributes)
attributes.each do |key, value|
self.send("#{key}=", value)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment