Medium badge

Ruby on Rails Explorer


This badge is awarded to web developers who have built a working Ruby on Rails app and shared the story of how they learned Rails.


Hank Holiday


Awarded badge on March 25, 2014

Medium a0c02ce595eba35de06758550aaaf40c

Endorsements & Feedback


Self-validation of badge creator

Hank Thompson created the badge on March 26, 2014 at 12:52 AM and was automatically awarded the badge.
Small a0c02ce595eba35de06758550aaaf40c hankish About 5 years ago

Badge Portfolio

Your Learning Story

Evidence visible to public

How I learned Rails - Part 1 - Rails Tutorial

This is my #learning-story.

I started with the The Ruby on Rails Tutorial by Michael Hartl (  This tutorial in general is fantastic, really really awesome.  My favorite part is how complete it is.  Michael walks you through every little detail of setting up your environment and links to lots of other useful resources.

As I went through the tutorial, though, I ended up pulling up a lot of other resources.  Below is an adapted version of my notes as I worked through the tutorial.  It took me about two months to work through the tutorial.  I was only working on it intermittently but it still took longer than I was expecting.

What the heck is REST?

The Rails Framework is deeply opinionated about being RESTful.  This was embarrassing because I thought I knew what that meant but had to do some research before I really grokked it.

The key thing about REST is that the URI is the noun and the standard HTTP methods are the verbs. (" If your URLs have action words in them, you're doing it wrong.") ...
Walked through this tutorial on the underlying Ruby language: 

Using git

Git reference book : ;

First time setup of repository
$ git init
[tailor .gitignore file]
$ git add .
$ git status >> optional: checks the status
$ git commit -m "Initial commit"

Setting up remote stuff
General git reference: 
$ git remote -v >> list configured remotes
$ git remote add origin >> sets up the remote (origin can be anything, repository should be the name of the configured repository on github)
$ git push -u origin master >> after one call to this you can just call "git push"
$ git remote rm origin >> removes remote
$ git remote rename origin newOrigin >> rename remote

$ git checkout -b new-branch-name >> creates a new branch (leaving out -b just switches branches)
$ git branch >> shows all branches with a star next to the active one[make your changes]
$ git status >> checks the status
$ git commit -a -m "message" >> commits all changes to EXISTING files 
or... $ git add . >> to add files, then >> $ git commit -a -m "message" >> to commit
$ git co master >> checkout master
$ git merge new-branch-name >> merges the new branch into master
$ git branch -d new-branch-name >> gets rid of the new branch (use capital -D to remove without merging first)>> to move a file without it counting as a deletion use "git mv file.rb newfile.rb"

Deploying to heroku
[first make sure you've added postgresql gem >> gem 'pg']
$ heroku login
$ heroku create "hrt-testapp" >> creates a subdomain for "" (you can leave the name off to get an auto generated one), also adds "heroku" as a remote to git
$ git push heroku master >> pushes the master branch to the active app
$ heroku open >> opens the active app in a web browser
$ heroku rename railstutorial >> optional: rename your app
$ heroku logs >> if you have problems this opens the deployment logs

Restoring a project from github (When switching development machines)
$ git fetch origin >> still not sure what this does but it's important
$ git fetch origin master
$ git co -b cur-github origin/master >> checks out the master branch from github and saves it in a branch called "cur-github"
$ git co master >> switch back to master
$ git merge cur-github >> merges into master
$ git branch -d cur-github >> removes the github branch
$ bundle install --without production >> installs any missing gems

Other miscellaneous links

How I learned Rails - Part 2 - Developing a strategy.

After finishing the Rails tutorial I felt much more knowledgeable about Rails.  I also felt very ready to stop working on a fake app and start working on the real thing.

I spent a month or two developing wireframes and iterating them with feedback from my partner Ben and the potential users he was interviewing. Then I put together the first entity relationship diagram for the Badge List and tried to scope out a basic learning strategy.

My Self-Directed Learning Strategy

  1. Figure out what database and gems I wanted to use
  2. Learn about each gem
  3. Study up on ruby conventions
  4. Start coding the app!

How I learned Rails - Part 3 - Doing research and picking gems

I had no clue about this part.  I knew that I needed to figure out what the app was going to be shaped like, answering questions such as: 
  • What parts would be gems? / What parts would I code myself?  
  • What database would I use? / How would the database be structured?  
  • Where should I start coding?
What I didn't know was how to answer any of those questions with google.  So I phoned a very helpful friend who was also new to Rails, but was much farther down the path than I.  He had just launched a Rails-based project of his own.

Notes from call with friend

Source Control
Github for source control (worked with svn a while ago but git is even easier)

The nice thing about bootstrap is
  • If you use it default, out of the box the html and css is super high quality.
  • It has a grid based layout system that’s easy
  • It’s almost automatically responsive
  • Alternatives to Bootstrap
    • Foundation: In the end they are really really similar. He went with bootstrap because it’s from twitter.  They are both really good frameworks and almost do exactly the same thing.  Very similar syntax.
    • There are other frameworks if you just want responsive or something else specific, but most of them do not have the same level of design assistance that bootstrap & foundation have.
Other recommendations for gems, frameworks & tools
  • For hosting he recommended Heroku to start
  • Rails for sure
  • Bootstrap
  • Backbone (optional: it makes the app nicer, but it adds a bit more complexity). You could also use the rails ERB view layer
  • Errors / ticket / bug tracking: RedMine (open source, ruby), (captures errors in production and sends you an email)
  • Mobile apps:  
    • You need to have an API to do this, so that’s a good reason to go with the javascript client because it forces you to build the API in the beginning.
  • Amazon:
    • >>; Hosted MySQL type data-base. Works really well. Takes care of redundancy and performance. (Heroku has their own mysql / postgres setup.)
  • Mysql vs. Postgres
    • Postgres is completely open source
    • Documentation is better than mysql
    • >> Has he looked into NoSQL / CouchDB? >> He tried to use it but didn't end up doing much with it. (He tried amazon’s dynamodb and also used mongodb.  Look at that if you’re going NoSQL).
      • >> Why use it? > You cannot use it for everything.  Sometimes a relational DB is better.  People use it a lot for high traffic applications.
      • If you use relational you might do a big join to figure out which posts are yours
      • But with nosql you can query an entire document (complete structure).
      • You might have redundant data
      • But accessing it is faster because you don’t have to do joins
      • He would say you could probably do the same thing with caching (like memcache)
    • Rails Gems
Authentication & Social Sign-in
There’s a good rails gem called devise (google: devise gem). It’s the most popular user management / authentication plugin for rails. It works well with the JS client architecture too, but it’s a great gem no matter what.  There are plugins for almost every oauth system you can find (google, facebook, etc)

Good learning resources?
RailsCasts is the best.  Paying for a Pro account is worth it.

Best practices?
There are not many great resources for ralis best practices out there.  The books are ok, but usually they teach you to write unmaintainable ‘spaghetti code”.  
  • For instance: you will see lots of examples where lots of code is in the controller, but it’s often better to put more code into the model layer because it reduces code duplication. (Best practice: lean controller, fat model)
  • Use many gems.  For all of the basic, standard stuff there is a gem available and they’re all pretty good.  (Best practice: Don’t reinvent the wheel)

More Research

After the conversation I did some more research on my own.

Backbone ; ;

>> Determination: Backbone seems too complicated, another thing to learn.  Skip it for now.


SASS or LESS? >>; Overview of my options for using bootstrap with rails (NOTE: A little outdated.. 2011) ;
>> this one is way better
>> MY DETERMINATION: Stick with SASS.  Both seem fine, but SASS is based in Ruby so I'm pretty safe in picking it.  Additionally, at this early juncture my own instinct is very raw, but the rails tutorial used SASS and that guy is an expert so that's good enough for me.>>; He recommends using simple form (which includes bootstrap support) to get the validation to work without messing up your markup >> More about simple form in episode 264

MongoDB >> Note: This one is kind of old (2009) so it's probably pretty out of date.

Heroku specific (MongoHQ vs Mongolab)
>> Determination: Mongo lab has better support ( )
>> People on quora ( also seem to prefer mongo lab .  Higher prices but more reliability or something.

Devise >>; wow... enabling social sign-in is (while well documented) something of an undertaking. I'm revising this as not an MVP thing.  I'm also looking to investigate a question: What is the point of social sign in??

>> The takeaway: Meh... social sign in is DEFINITELY not needed for now. Even if we go for it later a question must be answered first: what is the specific goal of adding social sign in? What do we stand to gain?  How will it make our user experience better?  How will it help the users?

Ruby Conventions
How should I write my Ruby code in order to have it comply with community standards and make it pretty? >>; They have a lot of other style guides too (CSS, Javascript, etc)
Formatting Documentation:

The End Result - My Decisions

After many days of research and thinking, this is the initial design I went with:
  • Database: MongoDB - I was initially intrigued by not having to do migrations, but what clinched it for me was the argument that relational databases were designed before the advent of web apps and are not properly suited to the task.  It felt true to me: When I think about it there are so many limitations to having to get your data to "fit" into a relational DB.  With document-based databases you can store arrays and hashes and have the flexibility to add new fields at any time.  It just makes more sense.
    • MongoDB gem: Mongoid - It seemed like this gem was more modern.
    • MongoDB host company: MongoLab - This decision was based mostly on a response to a quora question.
  • User Authentication: Devise - Super popular, works with Mongoid.
  • CSS Framework: Bootstrap - Really actively developed, well used, compatible with lots of other gems. Great documentation.  Started by twitter which is a plus for me.
  • Testing Gem: RSpec - What I was used to after the Rails tutorial.

How I learned Rails - Part 4 - Building Badge List

At this point I was three to six months into my learning process, depending on how you define it.  And though I had done a lot of work up to this point, the real learning didn't actually start until I began building the app (this app, Badge List).

Below are some chaotic notes from the building of Badge List.  I hope to come back and clean these up later.

Bootstrap >> Bootstrap color variables  >> Bootstrap documentation bootstrap sass variables:

Rspec Syntax

Note: The standard documentation is super annoying… looking for good examples / references

Maybe this? >> >> nope… this one! >>

More tips…

Open Badge Framework

Step 1 >> >> This is like the holy grail. It’s the metadata spec, super well written.
Step 2 >> >> This explains how to actually get the badge into your backpack


This is the best file uploading thing to use… not sure if it supports non-image uploads. >> yes it does support non-image files >>

Devise >> Better format here:

Good news… devise now supports mongoid by default!! :D … here’s another guy’s 2011 post on the setup >>

Adding a custom user view…


How to send and receive email in Rails >>
Picking a cloud email provider > Done!  I went with postmark primarily because they are 100% focused on transactional email..  I figure we can use another provider for marketing emails altogether.


RSpec Generators
rails generate rspec:model widget >> spec/models/widget_spec.rb rails g rspec:controller width >> spec for the controller

What’s the difference between feature specs and other specs (request specs)? >> The railstutorial guy says he’s moving towards feature specs in future editions
  • Starting with capybara 2.0 there are two separate folders…
    • spec/requests >> Do not include capybara by default. Best practices: use methods like get, post, put and delete and assert against response. Use describe / it
    • spec/features >> Use capybara and the visit method, usually assert against page. Use feature / scenario
Now I’m getting confused about how models & controllers fit into this… >> meh, that last one was only passingly helpful given my current understanding level, perhaps it will make more sense later.  from the rspec documentatin here are the different types…
  • Model Specs
  • Controller Specs
  • Request Specs
  • Features Specs
  • These don’t seem as big...
    • View Specs
    • Helper Specs
    • Mailer Specs
    • Routing Specs
Capybara cheat sheet: Capybara rspec matchers >> Capybara finders >>

Controller Tests >>

Simple Form 

Add it to the gem file and update $ rails g simple_form:install --bootstrap then it says to be sure to add the simple form tag into the erb along with a bootstrap form class ex >> simple_form_for(@user, :html => {:class => ‘form-horizontal’}) do |form|


great example of using simple form with bootstrap >>

Initial Mongoid Setup

  • create the app
  • rails new app_name --skip-active-record
  • add this to the gemfile gem ‘mongoid' gem 'bson_ext' then run bundle update
  • create a scaffold for the badges >> rails g scaffold badge name image_url summary description

Mongoid Notes >> NOTE: The DSL for querying actually comes from Origin >>

Querying into arrays >>

For future reference: Carrierwave image uploading to mongoid / gridfs >> this is a good walkthrough, but… this is the generic / best place to start…

How to serve images from a database field

Many to many relationships in mongoid?? Looks like this is not best practice? >> >> my exact use case!

Ruby Notes

Ruby and rails variable naming conventions >>

Finding syntax errors in a rake task… basically just try to compile it with the “w” option >> ruby -wc lib/finder.rb

Rails Notes

Temporarily turning off automatic rails timestamps

Research 1: >> Research 2: I need to truly understand how ajax is supposed to work in rails.  

How to create a new app and specify the version… $ rails _2.1.0_ new myapp

when first using bundler be sure to do this >> bundle install --without production >> the w/o production part will be remembered in future bundle calls

also remember to update the gitignore file! (at least i think this is important)

add rspec / capybara right away then do this >> $ rails generate rspec:install >> configures app to use rspec instead of test::unit

Best practices for bulk data updating in a controller (in a restful manner) >>

Time Zones >> how to get a list of time zones… $ rake -D time
$ rake time:zones:all
$ rake time:zones:us

Environment Variables

Relationships relationships in mongoid >>

Semantic URLs / Vanity URLs / Understanding custom routing

This is so hard to find info on.
But I think this is it: >> NOPE… too complex, depends on the friendly url gem which is (a) overkill and (b) i believe doesn’t support mongoid

This is the best one: >> This does do a great job of explaining all the pieces. ++ >. This is also useful for reference ….
  • First you have to nest the routes and use the :path parameter to allow them to be matched without the model name in the url
  • Then you have to override the to_param instance method
  • Then you have to either override self.find in the model OR add a validation method that implements an alternate find strategy
This is an important piece as well:

Two other ref links:,

Validating Semantic Profile URLs >> this is actually the one that mongoid uses, though i think it’s the same validating from a list and including nil >> Validating “vanity profile urls” This is the easy way >>

This looks like the better way to do it but sounds harder >> there’s also a gem that does super fancy stuff >>

UTF-8 Encoding

I had some problems storing the badge images directly in the MongoDB documents.  It turns out they were just problems with the encoding getting garbled. ;

Screenshots of Your Work

Evidence visible to public

What I built - Badge List Screenshots

It took about 3 months to get the first version of Badge List up and running.  It's been about 2 months since then and in the intervening time the app has gotten a lot more polish but looks mostly the same as it did upon initial release.

The Bootstrap Framework has been tremendously beneficial.  All of the included components and styles are extremely useful as a starting point, though I've tweaked / overwritten most of the defaults at this point.  Badge List is still using Bootstrap 2, the final release of Bootstrap 3 came out just after I started developing.

The rest of the design work was done myself, which is why everything is pretty basic (I'm not a professional designer) and text-focused (making graphics is not my specialty).  I should also mention the Font Awesome project (, Badge List uses their icons throughout the site.  Having a good vector-based icon library has been incredibly helpful.

Screenshots of Badge List

Badge List Home & Tuturial Modal

Viewing a Learning Group

Creating a New Badge

Badge Views

Viewing a Progress Log

Responsive Design Example
Viewing a progress Log Post at multiple screen sizes.

Code Sample

Evidence visible to public

No evidence submitted for this requirement


Let's gather 10,000 Ruby on Rails learning stories

I was able to "teach myself" Ruby on Rails in under a year for free.  It took me about 11 months to go from no knowledge of Ruby syntax or the Rails architecture to launching a fully-functional Rails-based web app (the web app you’re looking at right now).  The words "teach myself" are in quotes because I didn't really teach myself anything.  I was taught by a ton of awesome people via the free content they shared on the internet.  So the uniquely modern situation in which I find myself is this:  I have achieved proficiency in a subject without ever meeting any of my teachers or connecting with any of my fellow students.

The Problems with Learning in a Bubble

Part of me absolutely loved learning without having to make much direct social contact.  The anti-social, heads-down coder in me values efficiency and avoiding unnecessary complications -- like human contact and dealing with the opinions of others.  But the bigger part of me feels like I missed out on something by going it alone.

The Three Pillars of Traditional Schooling:
  1. Learning Content - Textbooks, instructions, exercises, videos and other forms of educational media
  2. Community of Peers - Working with other learners and forging social connections with similarly interested people
  3. Expert Guidance - Working directly with subject-matter experts and receiving personalized guidance
Looking at the list above I see that though my self-directed online learning nailed the first pillar, the second and third pillars were almost entirely missing.  By learning in my own little bubble I got very few opportunities to connect with my peers.  And because I never participated in any formal training programs the guidance I received from experts was pretty much limited to reading answers on Stack Overflow (super useful but not quite as awesome as direct human interaction).

There are, of course, tons of options out there already for folks who want more learning community: we can find local meetups to attend, we can ask questions on various online forums, we can join groups of Facebook or LinkedIn.  I've explored each of these options and have found that none have quite scratched the itch for me.  But in my work with Open Badges and social learning I think I might have have come upon a better way.

Sharing Learning Stories

I want to get 10,000 Rails experts and enthusiasts to share the stories of how they learned Rails and what they've built, along with lists of the resources, tips and tricks they found useful along the way.  And I want everyone to share those stories not on Facebook or their own blogs, but in a shared community badge.

What’s the point of sharing learning stories?
  • Sharing our stories helps demystify the process of learning Rails.
  • Putting names and faces to our learning experiences helps learners find potential expert guides.
  • Eventually the community can parse through the open database of stories and begin to pull out patterns, create maps of shared high-level learning goals and create suggested learning pathways.
But why badges?
  • Badges make it easy to recognize achievements.  (You've either earned a badge or you haven't.)
  • New learners can join the badge as an apprentice and share their progress as they go, receiving guidance from the community along the way.
  • Organizing a community around badges keeps everyone focused on the goal: helping people learn how to build Rails apps.

This is not about creating yet another Rails tutorial.  This is about building a community of humans that serves as glue, piecing all the available learning content together into a complete learning experience.  This is about creating a learning community which begins with content then adds peers and guidance -- something more like a real school.

How to Help