Skip to content

Instantly share code, notes, and snippets.

@7even
Created October 10, 2012 13:42
Show Gist options
  • Save 7even/3865722 to your computer and use it in GitHub Desktop.
Save 7even/3865722 to your computer and use it in GitHub Desktop.
def defaultify(hash)
hash.default_proc = ->(hash, key) {
hash[key] = Hash.new
}
end
class UsersController < ActiveRecord::Base
def create
defaultify(hash)
# code
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment