December 30 - Converting a Hash to a URL Friendly String
This coding exercise walks through how to convert a Ruby hash to a URL friendly string, including how to organize the parameters.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Create a hash converter method that converts a hash to a URL friendly string.

Exercise Description

Given any number of hash items, such as:

hash = { :topic => "baseball", :team => "astros" }

Convert the hash keys and values into a URL friendly parameter string.

Sample Output

'topic=baseball&team=astros'

Real World Usage

This is a process that you will use in a few scenarios. Most importantly, working through this exercise will teach you how you can manipulate keys and values inside of a hash and how to convert them into strings. Additionally, this process is important whenever you're working with URL parameter values.

Test Cases

Code File