Posts tagged programming

Jan19

Rails date calculations could stand some timezone love

programming rails ruby | comments

New Rails handles a lot of timezone stuff for you. Set the appropriate time zone for the request and get an object from the DB, it’s created_at date will be translated from UTC to the request’s time zone.

Continue reading »

Jan16

Thawing the brain

brain hacking code freeze development programming software engineering | comments

This post originally published at the [Iridesco Watercooler](http://watercooler.iridesco.com/post/70998011/thawing-the-brain). Continue reading »

Oct16

Fading flash message

flash message programming rails ruby | comments

Rails apps love flash messages. Little notes providing information, confirmation or warnings to the user. Typically implemented in a partial like so:

Continue reading »

Aug21

Blogiversaire

programming rails ruby | comments

Four years baby. Soon the blog will be toting a lunch pail and school bag, off to decades of education. Next thing I know, my little baby will be married and have little blogs of its own. Blog, you grow up so fast!

Continue reading »

Nov28

Rails before_destroy gotcha

Ruby Rails programming | comments

So there’s a Category that has many Expenses. The expenses for a category are destroyed when the category is destroyed. Elsewhere in my logic I would like to know if the category is removable based on whether it has any expenses and, if it does, whether any of the expenses it has are greater than zero.

Continue reading »

Jul30

Don't forget the return value on Rails callbacks

Ruby on Rails programming Ruby on Rails programming | comments

This morning I spent a good while hashing on a problem in some new code I’m updating for a freelance project. I added a couple callbacks to an ActiveRecord model, and things that previously worked were broken. Unfortunately there were no errors in the model or exceptions in the system to give me a hint as to what went wrong. When I finally uncovered the problem, I was thankful that it was something I had never run into before.

Continue reading »