Skip to content

Instantly share code, notes, and snippets.

@compwron
Created December 9, 2014 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save compwron/eaa59d38c33e86f923ca to your computer and use it in GitHub Desktop.
Save compwron/eaa59d38c33e86f923ca to your computer and use it in GitHub Desktop.
howto set all input fields from hash in ruby
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