Created
December 9, 2014 03:49
-
-
Save compwron/eaa59d38c33e86f923ca to your computer and use it in GitHub Desktop.
howto set all input fields from hash in ruby
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
def initialize(field_data) | |
field_data.each do |name, value| | |
instance_variable_set("@#{name}", value) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment