RailsConf 2012 Ignite Talk: ActiveRecord and Velveeta

My ignite talk (5 minutes, auto-advancing slides) talk from RailsConf 2012 is online.

Why I Built Ruby Off Rails

I built Ruby off Rails because ruby is awesome, and there are too many developers who don’t realize it. And the more I trained people, the more I found that: Developers who learn ruby first learn Rails Best. ###Announcing: Ruby Off Rails

That means, they pick up on concepts about instance variables, validations, how to create non-ActiveRecord classes, and most importantly: testing.

The One Where We DRY Up Mongoid and Rspec Using Shared Examples and Modules

The Situation: You’re adding Addresses to seemingly every document you have. Doctors, Patients, Insurance Agents. Even the Delivery Man – everybody has a contact.

The Problem: You’re tempted to copy/paste the field and validations, but your spidy-senses tell you not to.

Let’s DRY this up using modules and rspec shared examples. We’ll end up with a way you could enable fast rails tests on your Mongoid models.

The One Where You Too Can Have Bootstrap 2.0 and Compass in Rails

The situation: You’ve used compass in the past (even when it was hard to setup with rails), and love Bootstrap. You love bootstrap 2.0 and <3 Responsive design but don’t use LESS (because obvs). What do you do? Let’s make this happen

The One With a JSON API Login Using Devise

The situation: You need to add an iOS app to your Rails application. Users can login to both locations, and you’re using Devise for authentication.

The problem: How do you authenticate users on the iPhone using an email/password created on the website? And how do you tell Devise not to redirect to a login page when you’re using a JSON API?

The One Where I Deliver Ruby to a Non Programmer

The Situation: Write a program that parses XML files into a custom CSV format. So I do this, and write the app using TDD with no user interface.

To test it against live data, I slap a ruby script on it that I can run from the command line, show it to the client and he’s ecstatic. Now to deliver the command line app to him.

Except… Client does not program ruby. Client has the standard Mac setup with ruby 1.8.7 installed with no GCC compiler.

So. I created a wiki cheat sheet for client to view (using this blog Github pages). With no xCode setup!

The One Where Unicorn Doesn’t Update on Deploy

Things that are true:

  • We love Github
  • Github uses Unicorns
  • Github deploys all.the.time

Therefor: We should be using Unicorn instead of Passenger.

However, my recent switch to unicorn wasn’t all Unicorns and Rainbows! (pun definitely intended). For me, here’s what I saw:

The One Where ActiveAdmin and Mongoid Get Along

So you like ActiveAdmin, but are using Mongoid. And so far, ActiveAdmin hates on Mongoid because it uses ActiveRecord instead of ActiveModel. What’s a Mongoid to do? Develop your own admin system? As If!

The One Where Devise Validations Are Customized

The situation: You use Devise, and want to make emails optional because you login via username and why bother with emails?

Or maybe you want to be able to re-use email addresses as logins, say across subdomains. Or even multiple email addresses?

Your problem: Devise validatable hates on this and laughs are your attempts.

The One With HTML5 Videos Using Zencoder for VideoJS.com

Things that are true:

  • HTML5 is cool
  • HTML5 Videos are Cool
  • Getting HTML5 Video formats OMG all of them created … NOT cool

VideoJS.com will create an HTML5 embed for you that will render in iOS devices, all the modern browsers, and will fallback to flash for IE 6/7/8 types. However, to get all this goodness, you have to create your video file in 3 different formats:

  • h.264
  • web-m
  • Theora

The Voyeur gem looks cool (in that you can use it to create all three formats at once), but it seems to only work for ubuntu. What’s a mac fanboy to do?