Sending email: Controllers versus Models
While reviewing some code recently, I came across controller code that resembled the following.
if @customer.save
CustomerMailer.deliver_welcome_message(@customer)
flash[:message] = "Your account has been successfully created. We've sent you a welcome letter with..."
redirect_to dashboard_path
else
...
endFairly typical Rails code. Nothing alarming here, but I wanted to evaluate the call to the mailer in...
Using BETWEEN for SQL comparisons
Recently, Carlos, suggested that I should start sharing some basic SQL tips that help with performance and/or general usage. I recently came across some code that I didn’t like to read and/or write. For example, let’s take the following…
SELECT * FROM brochures WHERE published_at <= now() AND archived_at >= now()
Essentially, this is pulling back...
Launching Ruby on Rails projects, the video
For those of you who didn’t make it to Rails Underground in July to witness my mind-blowing talk, Launching Ruby on Rails projects , it appears that Skills Matter has finally posted a video of it online. :-)
The sound levels are really low… but hopefully you’ll find it helpful.
You can also
Flash Message Conductor now a Gem
We’ve been doing some early (or late… if you’re a half-full kind of person) spring cleaning on some of our projects. One of the small projects, flash_message_conductor, which we released last year as a plugin is now a gem. We’ve been moving away from using plugins in favor of gems as we...
Planting the seeds
Yesterday, the Rails team released 2.3.4, which includes standardized way for loading seed data into your application so that you didn’t have to clutter your database migrations.
I noticed a few comments on some blogs where people were asking how to use this new feature, so here is a quick runthrough a few ways that you...
Using model constants for project sanity
On one of our larger client projects (approx. 160 models and growing…) we have a specific model that we refer to quite a bit throughout our code. This model contains less than 10 records, but each of them sits on top of an insanely large and complex set of data. Each record refers to a...
Aliasing resources in Ruby on Rails
Earlier today, a friend working on a project asked me how we approached routes on our website. If you take a quick peak at our website, you’ll see that we have URLs like so:
- http://planetargon.com/
- http://planetargon.com/who-we-are
- http://planetargon.com/who-we-are/robby-russell
I couldn’t remember where I came across this before and wasn’t quickly finding it in the Ruby...
Howdy Rip!
Chris Wanstrath (@defunkt) just posted the following on twitter.
“Hello Rip – http://hellorip.com/“
The Rip project describes itself as, “an attempt to create a next generation packaging system for Ruby.”
One of the cool features is that it supports multiple environments. For example, you can have different Rip environments (with different gem versioning) that are...
Hello, HeyBrainstormr.com
If you follow me on twitter, you might have heard that we launched a little project that we’ve been cooking up at Planet Argon. (news post)
HeyBrainstormr is a lightweight web application that we created so that we could start a brainstorm on a specific topic and solicit ideas from each other....
82,520 minutes on Phusion Passenger
It’s been over 83,520 minutes since I made the switch from using mongrel as my development environment web server to Phusion Passenger. I’ve been extremely impressed with it. Our team has all switched over and haven’t really hit any obstacles in the transition.
Since some people asked me to let them know how this...

