Skip to content

Instantly share code, notes, and snippets.

@aziflaj
Created January 15, 2018 15:00
Show Gist options
  • Save aziflaj/cdd2b11e524a4454f7af3b519fe64077 to your computer and use it in GitHub Desktop.
Save aziflaj/cdd2b11e524a4454f7af3b519fe64077 to your computer and use it in GitHub Desktop.
def deep_search(key, params, found = nil)
return params.fetch(key) if params.has_key?(key)
params.each_pair do |_, v|
next unless v.is_a? ActionController::Parameters
found = deep_search(key, v)
end
found
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment