Share
Embed
Code Spelunking: Teach Yourself How Rails Works
Have you ever wondered how something works deep in the guts of Rails or been stuck when a README says one thing but the code acts another way? Guides and docs are often the best way to get started but when they fall short, you may need to get your hands dirty.
Using method introspection, this talk will show you ways to confidently explore Rails code. By looking at common problems inspired by real-world situations, learn how to dive into Rails and teach yourself how any feature works under-the-hood.
Let’s go spelunking!
Jordan Raine
May 02, 2019
Transcript
272 slides
-
<?php require( dirname(__FILE__) . '/db-config.php' ); $connection = connect_to_database($db_user, $db_password);
$post = $connection->query("SELECT * FROM posts WHERE slug = '%".$_SLUG."%';"); ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <?php require( dirname(__FILE__) . '/head.php' ); ?> <body> <h1><?php $post["title"]; ?></h1> <div class="content"> <?php $post["body"]; ?> </div> </body> <?php require( dirname(__FILE__) . '/footer.php' ); ?> </html> -
Measuring Program Comprehension A Large-Scale Field Study with Professionals Xin
Xia , Lingfeng Bao, David Lo , Zhenchang Xing, Ahmed E. Hassan, and Shanping Li Published 30 July 2017 ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ ̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉̉ * -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 82% 5% 13% -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 82% 5% 13% -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 82% 5% 13% -
No comments or insufficient comments Meaningless classes/methods/variable names Large number
of LOC in a class/method Inconsistent coding styles Lack of documentation, ambiguous requirements Unfamiliarity with business logic Query refinement, browsing a number of search results Navigating inheritance hierarchies Many third-party libraries Poor IDE support for code navigation Switching between editor/IDE and browser -
1. Write code that is easier to use and change
2. Improve our ability to find answers future you you -
The more experience someone had, the less time they spent
on program comprehension. -
$ rails new blog ! " 77 gems >250k LOC
12 core gems 75k LOC How this was calculated: https://gist.github.com/jnraine/b0f7bb5a4a5b10ff07274389e2de83ad -
define_method "#{callback}_action" do |*names, &blk| _insert_callbacks(names, blk) do |name, options|
set_callback(:process_action, callback, name, options) end end -
%w{ Symbol Slash Dot }.each do |t| class_eval <<-eoruby, __FILE__,
__LINE__ + 1 class #{t} < Terminal; def type; :#{t.upcase}; end end eoruby end -
1. Ask a question 2. Start with what you know
3. Only read relevant code -
What’s the difference between try and try!? $ rails c
Loading development environment (Rails 6.0.0) >> "something".length => 9 >> nil.length NoMethodError: undefined method `length' for nil:NilClass -
What’s the difference between try and try!? >> "something".try(:length) =>
9 >> nil.try(:length) => nil -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> "something".try!(:length) => 9 >> nil.try!(:length) => nil -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> "something".try!(:length) -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> "something".try!(:length) -
>> Dog.new.methods =>[:good_boy?, :name, :to_json, :deep_dup, :acts_like?, :html_safe?, :w ith_options,
:duplicable?, :blank?, :present?, :presence, :to_yaml, :as _json, :instance_values, :instance_variable_names, :in?, :to_param, :pr esence_in, :to_query, :pretty_print_cycle, :pretty_print_instance_varia bles, :pretty_print, :pretty_print_inspect, :try, :try!, :require_or_lo ad, :load_dependency, :unloadable, :instance_variable_defined?, :remove _instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :instance_v ariable_get, :instance_variable_set, :protected_methods, :instance_vari ables, :private_methods, :method, :public_method, :public_send, :single ton_method, :define_singleton_method, :class_eval, :pretty_inspect, :ex tend, :to_enum, :enum_for, :<=>, :===, :=~, :! ~, :gem, :eql?, :respond_to?, :byebug, :remote_byebug, :debugger, :free ze, :inspect, :object_id, :send, :to_s, :display, :class, :nil?, :hash, :dup, :singleton_class, :clone, :then, :itself, :yield_self, :untaint, :taint, :tainted?, :trust, :untrust, :untrusted?, :singleton_methods, : frozen?, :methods, :public_methods, :equal?, :!, :==, :instance_exec, : -
>> Dog.new.methods.grep /instance/ => [:instance_values, :instance_variable_names, :pretty_print_instance_variables, :instance_variable_defined?, :remove_instance_variable, :instance_of?,
:instance_variable_get, :instance_variable_set, :instance_variables, :instance_exec, :instance_eval] -
>> dog = Dog.new => #<Dog:0x00007fedbe85ba48> >> dog.method(:name) => #<Method:
Dog#name> >> dog.method(:name).source_location => ["/spelunking/app/models/dog.rb", 2] -
>> dog = Dog.new => #<Dog:0x00007fedbe85ba48> >> dog.method(:name) => #<Method:
Dog#name> >> dog.method(:name).source_location => ["/spelunking/app/models/dog.rb", 2] >> dog.method(:name).source -
>> dog = Dog.new => #<Dog:0x00007fedbe85ba48> >> dog.method(:name) => #<Method:
Dog#name> >> dog.method(:name).source_location => ["/spelunking/app/models/dog.rb", 2] >> dog.method(:name).source ! gem “method_source” -
>> dog = Dog.new => #<Dog:0x00007fedbe85ba48> >> dog.method(:name) => #<Method:
Dog#name> >> dog.method(:name).source_location => ["/spelunking/app/models/dog.rb", 2] >> dog.method(:name).source => " def name\n \”Foxley\"\n end\n" -
>> dog = Dog.new => #<Dog:0x00007fedbe85ba48> >> dog.method(:name) => #<Method:
Dog#name> >> dog.method(:name).source_location => ["/spelunking/app/models/dog.rb", 2] >> dog.method(:name).source => " def name\n \”Foxley\"\n end\n" >> dog.method(:name).source.display def name “Foxley" end => nil -
>> Post.create(title: "Code spelunking") >> Post.method(:create).source.display def create(attributes = nil,
&block) if attributes.is_a?(Array) attributes.collect { |attr| create(attr, &block) } else object = new(attributes, &block) object.save object end end => nil -
>> Post.create(title: "Code spelunking") >> Post.method(:create).source.display def create(attributes = nil,
&block) if attributes.is_a?(Array) attributes.collect { |attr| create(attr, &block) } else object = new(attributes, &block) object.save object end end => nil -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method => #<Method: ActiveRecord::Validations#save> >> ✅ ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method => #<Method: ActiveRecord::Validations#save> >> Post.new.method(:save).super_method.super_method.super_method ✅ ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method => #<Method: ActiveRecord::Validations#save> >> Post.new.method(:save).super_method.super_method.super_method => #<Method: ActiveRecord::Persistence#save> >> ✅ ✅ ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method => #<Method: ActiveRecord::Validations#save> >> Post.new.method(:save).super_method.super_method.super_method => #<Method: ActiveRecord::Persistence#save> >> Post.new.method(:save).super_method.super_method.super_method.super_method ✅ ✅ ✅ ✅ -
>> Post.new.save >> Post.new.method(:save) => #<Method: ActiveRecord::Suppressor#save> >> Post.new.method(:save).super_method =>
#<Method: ActiveRecord::Transactions#save> >> Post.new.method(:save).super_method.super_method => #<Method: ActiveRecord::Validations#save> >> Post.new.method(:save).super_method.super_method.super_method => #<Method: ActiveRecord::Persistence#save> >> Post.new.method(:save).super_method.super_method.super_method.super_method => nil >> ✅ ✅ ✅ ✅ -
>> "something".method(:empty?).source MethodSource::SourceNotFoundError: Could not locate source for empty?! >>
"something".method(:empty?).source_location => nil -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> -
try(:length) try!(:length) "something" 9 9 nil nil nil What’s the
difference between try and try!? >> -
What’s the difference between try and try!? >> "something".method(:try).source.display def
try(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end => nil >> -
What’s the difference between try and try!? >> "something".method(:try).source.display def
try(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end => nil >> -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end Only read relevant code -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end false -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... elsif respond_to?(method_name) public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... elsif respond_to?(method_name) public_send(method_name, *args, &b) end end -
What’s the difference between try and try!? >> "something".method(:try).source.display def
try(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end => nil >> -
What’s the difference between try and try!? >> "something".method(:try).source.display def
try(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end => nil >> nil.method(:try).source.display def try(method_name = nil, *args) nil end => nil -
What’s the difference between try and try!? >> "something".method(:try).source.display def
try(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end elsif respond_to?(method_name) public_send(method_name, *args, &b) end end => nil >> nil.method(:try).source.display def try(method_name = nil, *args) nil end => nil -
What’s the difference between try and try!? >> "something".method(:try!).source.display def
try!(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end => nil >> -
What’s the difference between try and try!? >> "something".method(:try!).source.display def
try!(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end => nil >> -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end false -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... else public_send(method_name, *args, &b) end end -
def try!(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... else public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... elsif respond_to?(method_name) public_send(method_name, *args, &b) end end def try!(method_name = nil, *args, &b) if method_name.nil? && block_given? # ... else public_send(method_name, *args, &b) end end -
def try(method_name = nil, *args, &b) if method_name.nil? && block_given?
# ... elsif respond_to?(method_name) public_send(method_name, *args, &b) end end def try!(method_name = nil, *args, &b) if method_name.nil? && block_given? # ... else public_send(method_name, *args, &b) end end -
What’s the difference between try and try!? >> "something".try(:lengthhhhh) =>
nil >> "something".try!(:lengthhhhh) NoMethodError: undefined method `lengthhhhh' for "something":String -
What’s the difference between try and try!? >> "something".method(:try!).source.display def
try!(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end => nil >> -
What’s the difference between try and try!? >> "something".method(:try!).source.display def
try!(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end => nil >> nil.method(:try!).source.display def try!(method_name = nil, *args) nil end => nil -
What’s the difference between try and try!? >> "something".method(:try!).source.display def
try!(method_name = nil, *args, &b) if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(method_name, *args, &b) end end => nil >> nil.method(:try!).source.display def try!(method_name = nil, *args) nil end => nil -
def try(method_name = nil, *args) nil end def try!(method_name =
nil, *args) nil end -
For nil, they’re the same. For everything else, try! is
more strict. What’s the difference between try and try!? >> "something".try(:lengthhhhh) => nil >> "something".try!(:lengthhhhh) NoMethodError: undefined method `lengthhhhh' for "something":String >> nil.try(:lengthhhh) => nil >> nil.try!(:lengthhhh) -
For nil, they’re the same. For everything else, try! is
more strict. What’s the difference between try and try!? >> "something".try(:lengthhhhh) => nil >> "something".try!(:lengthhhhh) NoMethodError: undefined method `lengthhhhh' for "something":String >> nil.try(:lengthhhh) => nil -
1. Ask a question What’s the difference between try and
try!? 2. Start with what you know Look at try and try! code 3. Only read relevant code Skim 20 lines, read 6 lines -
We need a way to keep track of which request
enqueued a job. Can you figure out a way to add that? -
class ApplicationController < ActionController::Base before_action do Current.request_id = request.id end
end class ReportsController < ApplicationController def create ReportJob.perform_later # ... end end -
class ApplicationJob < ActiveJob::Base attr_accessor :request_id end class ReportJob <
ApplicationJob queue_as :default def perform(*args) # ... puts "request_id: #{request_id.inspect}" end end -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start request_id: nil ReportJob JID-123 INFO: done -
How do we add request_id to every job? $ rails
c Loading development environment (Rails 6.0.0) >> -
How do we add request_id to every job? $ rails
c Loading development environment (Rails 6.0.0) >> ReportJob.method(:perform_later).source.display -
How do we add request_id to every job? $ rails
c Loading development environment (Rails 6.0.0) >> ReportJob.method(:perform_later).source.display def perform_later(*args) job_or_instantiate(*args).enqueue end => nil >> -
How do we add request_id to every job? $ rails
c Loading development environment (Rails 6.0.0) >> ReportJob.method(:perform_later).source.display def perform_later(*args) job_or_instantiate(*args).enqueue end => nil >> -
How do we add request_id to every job? >> ReportJob.job_or_instantiate.method(:enqueue).source.display
NoMethodError: private method `job_or_instantiate' called for ReportJob:Class from (pry):5:in `__pry__’ >> -
How do we add request_id to every job? >> ReportJob.job_or_instantiate.method(:enqueue).source.display
NoMethodError: private method `job_or_instantiate' called for ReportJob:Class from (pry):5:in `__pry__’ >> ReportJob.send(:job_or_instantiate) -
How do we add request_id to every job? >> ReportJob.job_or_instantiate.method(:enqueue).source.display
NoMethodError: private method `job_or_instantiate' called for ReportJob:Class from (pry):5:in `__pry__’ >> ReportJob.send(:job_or_instantiate).method(:enqueue).source.display -
How do we add request_id to every job? >> ReportJob.job_or_instantiate.method(:enqueue).source.display
NoMethodError: private method `job_or_instantiate' called for ReportJob:Class from (pry):5:in `__pry__’ >> ReportJob.send(:job_or_instantiate).method(:enqueue).source.display def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end => nil -
How do we add request_id to every job? >> ReportJob.job_or_instantiate.method(:enqueue).source.display
NoMethodError: private method `job_or_instantiate' called for ReportJob:Class from (pry):5:in `__pry__’ >> ReportJob.send(:job_or_instantiate).method(:enqueue).source.display def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end => nil -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 1 self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false 1. Variable assignment -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 1 self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false 1. Variable assignment -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 1 self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false 1. Variable assignment -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 1 self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at = options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false 1. Variable assignment -
def enqueue(options = {}) self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait] self.scheduled_at
= options[:wait_until].to_f if options[:wait_until] self.queue_name = self.class.queue_name_from_part(options[:queue]) if options[:queue] self.priority = options[:priority].to_i if options[:priority] successfully_enqueued = false run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 2 3 1 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 1 2 3 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 2 3 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 2 3 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 2 3 2 2. Method with a block run_callbacks :enqueue do if scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 3 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 3 2 -
3. Conditional if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else
ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code " returning the instance of the job and set `config.active_job.return_false_on_ " to remove the deprecations." ) self end end -
3. Conditional if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else
ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code " returning the instance of the job and set `config.active_job.return_false_on_ " to remove the deprecations." ) self end end -
if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails
6.0 will return false when the enqueuing is aborted. Make sure your code " returning the instance of the job and set `config.active_job.return_false_on_ " to remove the deprecations." ) self end end 3. Conditional -
if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails
6.0 will return false when the enqueuing is aborted. Make sure your code " returning the instance of the job and set `config.active_job.return_false_on_ " to remove the deprecations." ) self end end 3. Conditional -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end if successfully_enqueued self else if self.class.return_false_on_aborted_enqueue false else ActiveSupport::Deprecation.warn( "Rails 6.0 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \ " returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \ " to remove the deprecations." ) self end end end 2 3 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 3 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at self.class.queue_adapter.enqueue_at self, scheduled_at else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at # ... else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
def enqueue(options = {}) # ... run_callbacks :enqueue do if
scheduled_at # ... else self.class.queue_adapter.enqueue self end successfully_enqueued = true end # ... end 2 -
How do we add request_id to every job? >> ReportJob.queue_adapter.method(:enqueue).source.display
def enqueue(job) #:nodoc: # Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end => nil -
How do we add request_id to every job? >> ReportJob.queue_adapter.method(:enqueue).source.display
def enqueue(job) #:nodoc: # Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end => nil -
How do we add request_id to every job? >> ReportJob.queue_adapter.method(:enqueue).source.display
def enqueue(job) #:nodoc: # Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end => nil -
How do we add request_id to every job? >> ReportJob.new.method(:serialize).source.display
def serialize { "job_class" => self.class.name, "job_id" => job_id, "provider_job_id" => provider_job_id, "queue_name" => queue_name, "priority" => priority, "arguments" => serialize_arguments_if_needed(arguments), "executions" => executions, "exception_executions" => exception_executions, "locale" => I18n.locale.to_s, "timezone" => Time.zone.try(:name), "enqueued_at" => Time.now.utc.iso8601 } end => nil >> -
How do we add request_id to every job? >> ReportJob.new.method(:serialize).source.display
def serialize { "job_class" => self.class.name, "job_id" => job_id, "provider_job_id" => provider_job_id, "queue_name" => queue_name, "priority" => priority, "arguments" => serialize_arguments_if_needed(arguments), "executions" => executions, "exception_executions" => exception_executions, "locale" => I18n.locale.to_s, "timezone" => Time.zone.try(:name), "enqueued_at" => Time.now.utc.iso8601 } end => nil >> -
How do we add request_id to every job? >> ReportJob.new.method(:serialize).source.display
def serialize { "job_class" => self.class.name, "job_id" => job_id, "provider_job_id" => provider_job_id, "queue_name" => queue_name, "priority" => priority, "arguments" => serialize_arguments_if_needed(arguments), "executions" => executions, "exception_executions" => exception_executions, "locale" => I18n.locale.to_s, "timezone" => Time.zone.try(:name), "enqueued_at" => Time.now.utc.iso8601 } end => nil >> -
How do we add request_id to every job? >> ReportJob.new.method(:serialize).source.display
def serialize { "job_class" => self.class.name, "job_id" => job_id, "provider_job_id" => provider_job_id, "queue_name" => queue_name, "priority" => priority, "arguments" => serialize_arguments_if_needed(arguments), "executions" => executions, "exception_executions" => exception_executions, "locale" => I18n.locale.to_s, "timezone" => Time.zone.try(:name), "enqueued_at" => Time.now.utc.iso8601 } end => nil >> “request_id” => Current.request_id -
class ApplicationJob < ActiveJob::Base # ... def serialize super.merge("request_id" =>
Current.request_id) end end -
How do we add request_id to every job? >> Current.request_id
= "abcdef" => "abcdef" >> -
How do we add request_id to every job? >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.new -
How do we add request_id to every job? >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.new.serialize -
How do we add request_id to every job? >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.new.serialize["request_id"] -
How do we add request_id to every job? >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.new.serialize["request_id"] => "abcdef" >> -
>> Current.request_id = "abcdef" => "abcdef" How do we add
request_id to every job? -
>> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> How
do we add request_id to every job? -
>> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> m,
`$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| How do we add request_id to every job? -
>> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> m,
`$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start request_id: nil ReportJob JID-123 INFO: done How do we add request_id to every job? -
>> exit $ bundle open How do we add request_id
to every job? -
>> exit $ bundle open activejob How do we add
request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ export EDITOR="code -w" # VS Code, or $ How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ export EDITOR="code -w" # VS Code, or $ export EDITOR="vim" # vim, or whatever you use $ How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ export EDITOR="code -w" # VS Code, or $ export EDITOR="vim" # vim, or whatever you use $ bundle open activejob How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ export EDITOR="code -w" # VS Code, or $ export EDITOR="vim" # vim, or whatever you use $ bundle open activejob How do we add request_id to every job? -
>> exit $ bundle open activejob To open a bundled
gem, set $EDITOR or $BUNDLER_EDITOR $ export EDITOR="subl -w" # Sublime Text, or $ export EDITOR="code -w" # VS Code, or $ export EDITOR="vim" # vim, or whatever you use $ bundle open activejob How do we add request_id to every job? -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 def enqueue(job) #:nodoc: # Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end 1. enqueue method -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... def enqueue_at(job,
timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... def enqueue_at(job,
timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... def enqueue_at(job,
timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter def enqueue(job) #:nodoc: #
Sidekiq::Client does not support symbols as keys job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ] end def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 1 2 3 def enqueue_at(job, timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end 2. enqueue_at method -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... def enqueue_at(job,
timestamp) #:nodoc: job.provider_job_id = Sidekiq::Client.push \ "class" => JobWrapper, "wrapped" => job.class.to_s, "queue" => job.queue_name, "args" => [ job.serialize ], "at" => timestamp end class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... # ...
class JobWrapper #:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 2 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
module ActiveJob module QueueAdapters class SidekiqAdapter # ... class JobWrapper
#:nodoc: include Sidekiq::Worker def perform(job_data) byebug Base.execute job_data.merge("provider_job_id" => jid) end end end end end 3 -
$ rails c Loading development environment (Rails 6.0.0) >> How
do we add request_id to every job? -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> How do we add request_id to every job? -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start [26, 35] in activejob-6.0.0.beta3/lib/active_job/queue_adapters/sidekiq_adapter.rb 26: class JobWrapper #:nodoc: 27: include Sidekiq::Worker 28: 29: def perform(job_data) 30: byebug => 31: Base.execute job_data.merge("provider_job_id" => jid) 32: end 33: end 34: end 35: end (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? [26, 35] in activejob-6.0.0.beta3/lib/active_job/queue_adapters/sidekiq_adapter.rb 26: class JobWrapper #:nodoc: 27: include Sidekiq::Worker 28: 29: def perform(job_data) 30: byebug => 31: Base.execute job_data.merge("provider_job_id" => jid) 32: end 33: end 34: end 35: end (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? [26, 35] in activejob-6.0.0.beta3/lib/active_job/queue_adapters/sidekiq_adapter.rb 26: class JobWrapper #:nodoc: 27: include Sidekiq::Worker 28: 29: def perform(job_data) 30: byebug => 31: Base.execute job_data.merge("provider_job_id" => jid) 32: end 33: end 34: end 35: end (byebug) job_data -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? [26, 35] in activejob-6.0.0.beta3/lib/active_job/queue_adapters/sidekiq_adapter.rb 26: class JobWrapper #:nodoc: 27: include Sidekiq::Worker 28: 29: def perform(job_data) 30: byebug => 31: Base.execute job_data.merge("provider_job_id" => jid) 32: end 33: end 34: end 35: end (byebug) job_data { "job_class"=>"ReportJob", "job_id"=>"d13993c6-dd0f-4323-a1c3-544f2ed3b44a", "provider_job_id"=>nil, "queue_name"=>"default", "priority"=>nil, -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data { "job_class"=>"ReportJob", "job_id"=>"d13993c6-dd0f-4323-a1c3-544f2ed3b44a", "provider_job_id"=>nil, "queue_name"=>"default", "priority"=>nil, "arguments"=>[], "executions"=>0, "exception_executions"=>{}, "locale"=>"en", "timezone"=>"UTC", "enqueued_at"=>"2019-04-26T01:11:19Z", "request_id"=>"abcdef" } (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data { "job_class"=>"ReportJob", "job_id"=>"d13993c6-dd0f-4323-a1c3-544f2ed3b44a", "provider_job_id"=>nil, "queue_name"=>"default", "priority"=>nil, "arguments"=>[], "executions"=>0, "exception_executions"=>{}, "locale"=>"en", "timezone"=>"UTC", "enqueued_at"=>"2019-04-26T01:11:19Z", "request_id"=>"abcdef" } (byebug) job_data["request_id"] "abcdef" (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) job_data["job_class"].constantize.new -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:execute).source.display def execute(job_data) #:nodoc: ActiveJob::Callbacks.run_callbacks(:execute) do job = deserialize(job_data) job.perform_now end end nil (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) Base.method(:deserialize).source.display def deserialize(job_data) job = job_data["job_class"].constantize.new job.deserialize(job_data) job end nil (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) self.enqueued_at = job_data["enqueued_at"] end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) self.enqueued_at = job_data["enqueued_at"] end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) self.enqueued_at = job_data["enqueued_at"] end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) self.enqueued_at = job_data["enqueued_at"] end nil (byebug) -
$ rails c Loading development environment (Rails 6.0.0) >> Current.request_id
= "abcdef" => "abcdef" >> ReportJob.perform_later >> How do we add request_id to every job? (byebug) job_data["job_class"].constantize.new.method(:deserialize).source.display def deserialize(job_data) self.job_id = job_data["job_id"] self.provider_job_id = job_data["provider_job_id"] self.queue_name = job_data["queue_name"] self.priority = job_data["priority"] self.serialized_arguments = job_data["arguments"] self.executions = job_data["executions"] self.exception_executions = job_data["exception_executions"] self.locale = job_data["locale"] || I18n.locale.to_s self.timezone = job_data["timezone"] || Time.zone.try(:name) self.enqueued_at = job_data["enqueued_at"] end nil (byebug) self.request_id = job_data["request_id"] -
class ApplicationJob < ActiveJob::Base # ... def serialize super.merge("request_id" =>
Current.request_id) end end -
class ApplicationJob < ActiveJob::Base # ... def serialize super.merge("request_id" =>
Current.request_id) end def deserialize(job_data) end end -
class ApplicationJob < ActiveJob::Base # ... def serialize super.merge("request_id" =>
Current.request_id) end def deserialize(job_data) super end end -
class ApplicationJob < ActiveJob::Base # ... def serialize super.merge("request_id" =>
Current.request_id) end def deserialize(job_data) super self.request_id = job_data["request_id"] end end -
>> Current.request_id = "abcdef" => "abcdef" How do we add
request_id to every job? -
>> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> How
do we add request_id to every job? -
>> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> m,
`$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| How do we add request_id to every job? -
By adding it to serialization and deserialization. We add request_id
during serialization and set it during deserialization. >> Current.request_id = "abcdef" => "abcdef" >> ReportJob.perform_later >> m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start request_id: "abcdef" ReportJob JID-123 INFO: done How do we add request_id to every job? -
By adding it to serialization and deserialization. >> Current.request_id =
"abcdef" => "abcdef" >> ReportJob.perform_later >> m, `$b .ss, $$: .,d$ `$$P,d$P' .,md$P"' ,$$$$$bmmd$$$P^' .d$$$$$$$$$$P' $$^' `"^$$$' ____ _ _ _ _ $: ,$$: / ___|(_) __| | ___| | _(_) __ _ `b :$$ \___ \| |/ _` |/ _ \ |/ / |/ _` | $$: ___) | | (_| | __/ <| | (_| | $$ |____/|_|\__,_|\___|_|\_\_|\__, | .d$$ |_| ReportJob JID-123 INFO: start request_id: "abcdef" ReportJob JID-123 INFO: done How do we add request_id to every job? -
1. Ask a question How do we add request_id to
every job? 2. Start with what you know Look at perform_later. 3. Only read relevant code Skim 100 lines, read ~50 lines -
1. Ask a question How do we add request_id to
every job? 2. Start with what you know Look at perform_later. 3. Only read relevant code Skim 100 lines, read ~50 lines -
1. Ask a question How do we add request_id to
every job? 2. Start with what you know Look at perform_later. 3. Only read relevant code Skim 100 lines, read ~50 lines -
https://pryrepl.org/ >> show-source "hello".empty? From: string.c (C Method): Owner: String
Visibility: public Number of lines: 7 static VALUE rb_str_empty(VALUE str) { if (RSTRING_LEN(str) == 0) return Qtrue; return Qfalse; } -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 82% 5% 13% -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 82% 5% 13% -
Average Percentage of Time Spent by Developers 0% 25% 50%
75% 100% Comprehension & Navigation Editing Other 77% 10% 13% -
• Donald Giannatti, Unsplash, https://unsplash.com/photos/OVLa83nRaLQ • Niklas Hamann, Unsplash, https://unsplash.com/photos/Pe4gh8a8mBY
• By The original uploader was Minghong at English Wikipedia. - Transferred from en.wikipedia to Commons by IngerAlHaosului using CommonsHelper., CC BY-SA 3.0, https://commons.wikimedia.org/ w/index.php?curid=8922606 • Andrew Buchanan, Unsplash, https://unsplash.com/photos/Csf7vDp-Whc • Majid Rangraz, Unsplash, https://unsplash.com/photos/IPMaxeoHXi4 • Rachel, Unsplash, https://unsplash.com/photos/GGlz-QSvL38 • Rohan Makhecha, Unsplash, https://unsplash.com/photos/5fldl8eWIt0 • Eva Darron, Unsplash, https://unsplash.com/photos/oCdVtGFeDC0 • Mike Benna, Unsplash, https://unsplash.com/photos/5Cv3surFZM8 • Luc Tribolet, Unsplash, https://unsplash.com/photos/FQRxB1SimfI • Damian Zaleski, Unsplash, https://unsplash.com/photos/RYyr-k3Ysqg • Jennifer Regnier, Unsplash, https://unsplash.com/photos/sjP0USlCt10 Photo Credits