Skip to content

Instantly share code, notes, and snippets.

@arches
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arches/9517594 to your computer and use it in GitHub Desktop.
Save arches/9517594 to your computer and use it in GitHub Desktop.
The Rails Console - A Comprehensive Introduction

Working on a Rails app without using the console is like flying a 747 without instruments. You can see where you're going if it's nice out but hit some bad weather and you're lost in the dark. In this talk I'll teach you the battle-tested console commands and techniques I use on a daily basis. We'll be spiking features, databasing, patching production apps, automating grunt work - the sky's the limit. You will leave with a firm command of the console and its role in your workflow.

This talk targets the Rails novice that has a basic MVC understanding but is struggling to really connect with their app. I'll ground my talk in the ways I personally use the console on a daily basis. The goal is to impart ideas and techniques that are immediately useful to the audience. I'll touch upon concepts such as:

  • prototyping code
  • console vs IRB
  • viewing and manipulating the database (ActiveRecord and pure SQL)
  • how the console interacts with your app and shell environments
  • digging into a production bug
  • collecting and viewing DB stats
  • abuses of the console/ways you shouldn't use it

I'll be sure to present these topics with proper context for newer developers. I'm trying to impart a mental structure for thinking about the console, and specific techniques within that structure. Without the hooks to hang the knowledge, I'd be making noise instead of providing clarity. To me, that means cohesive real-world examples. It means not making assumptions about what people know. It means presenting the same key ideas in a few different ways to help them sink in and allow for different learning styles.

Attendees will leave a newfound confidence and excitement about the Rails console. They will open a console within 48 hours of the talk. They will be able to explain a day, a month, a year later what it can do and why it's important. While these metrics would be difficult to measure, they are my ideal outcomes and will be the guiding light I work toward in my preparation.

The Rails console is a major part of a developer's workflow - or should be, anyway. I remember that as a beginner it took me a long time to see the value and application of the console, but now I don't see how I could work without it. I love the power and simplicity of the console, and the way it lets me play around and just be in the moment. I want to help Rails novices get over the initial learning curve and jump-start their console journey.

As an eight-year industry veteran I have spent thousands of hours in the Rails console. I have developed a couple gems for the console: table_print and marco-polo. I have taught other introductory classes and mentored junior developers. My most recent ruby lecture was a 10-minute lightning talk about one of my console gems. A renowned ruby speaker told me that it was one of the best lightning talks he's seen. He felt I was able to really tell a story, which I took as a high compliment. I plan to work hard to bring that same level of simplicity and flow to this talk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment