Learn the solutions for the DELETE challenge and get an overview of Ruby.
- [Instructor] I hope you found the challenge fun.…While it was relatively straightforward…it did demonstrate a few things…I want you to consider when thinking about…the Ruby programming language.…First, the ability to use class methods directly…without creating an object is a big feature.…Everything, whether it's a string, and integer,…or a class, is an object,…and everything in Ruby is done with the theory of…sending messages to objects.…So let's scroll down and look at the delete.…So, in this first case, the quote variable is…being assigned the return value of…the message find_by being sent to the quote class.…
We can use that to_i to change strings to integers…because that's a method of the string class.…The question mark here on quote.nil…is syntactic sugar; it's markup…that doesn't change anything about the functionality,…but it's used by convention to increase…the readability of the code.…Next, quote.delete sends the delete message…to the quote object we created.…Then we send our 204 no content, and we're done.…
- Why become a polyglot programmer?
- Exploring Node.js, Python, Perl, and Ruby code
- Building on prior knowledge to learn new programming languages
- Learning API read and write functionality in Node.js, Python, Perl, and Ruby
- Implementing API functionality in Node.js, Python, Perl, and Ruby
Skill Level Intermediate
Building APIs Using Hapi in Node.jswith Kirsten Hunter2h 23m Intermediate
1. Becoming a Polyglot
Next steps1m 19s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.