Ruby

http://s.erious.ly

Posts tagged "patterns"

MongoMapper 0.7: Identity Map

In which I explain that a pattern learned is a query saved.

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
  ...
end

Fairly typical Rails code. Nothing alarming here, but I wanted to evaluate the call to the mailer in...

Patterns Are Not Scary: Method Missing Proxy

In which I show how to create a method missing proxy and provide some example uses in the wild.

Flash Message Conductor

Do you find yourself copying and pasting the same code from Rails application-to-application as new projects start? Our team has a handful of projects in development right now and we notice that some of these reusable components tend to get out of sync when we bounce between projects. So, we’re making an effort to spot...