Category Archives: Ruby

Be careful with assert_not_equal

As I discovered today, assert_not_equal has a pretty big problem: it does exactly what you ask it to do. I just need to make sure that a user has at least one record: assert_not_equal 0, UserPreference.find_by_user_id(user_id) As you may have … Continue reading

2 Comments

Filed under rails, Ruby, Test Driven Development (TDD)

Send an image

You’d think it would be easy to send an image to a client with a framework as wonderful as Rails. After doing quite a bit of searching for the simple way, I really didn’t turn up too much. Finally, I … Continue reading

Leave a Comment

Filed under rails, Ruby

String Concatenation

A reporting application I am working on requires the results of some quite large queries to be parsed and presented to users via a web page. The query timings are an issue themselves, requiring some creative SQL, indexes, views, and … Continue reading

Leave a Comment

Filed under Ruby

The Future, Conan?

Why aren’t my fixtures properly loading their ‘registered’ timestamps correctly? Ah, the dreaded Year 2038 issue loads fine: user_registered: ’2038-01-18 21:14:07′ not happy: user_registered: ’2038-01-18 21:14:08′ So, that fixture that I just wanted to have ‘a date way out in … Continue reading

Leave a Comment

Filed under rails, Ruby, SQL

Adding tests to rake

We’ve developed a few batch applications that live in the same directory structure as the Rails app they’re intimate with. So, the lib/foo/test/ contains some tests for the ‘foo’ batch app. lib/bar/test has the ones for ‘bar’ etc. It was … Continue reading

Leave a Comment

Filed under rails, Ruby, Test Driven Development (TDD)

Email Formatting

I’m working on-and-off on an application to send financial web content direct to your email inbox. Over the next couple years we’re going to see a very large conversion as the incredible convenience of rss is generally accepted (and not … Continue reading

Leave a Comment

Filed under Email, Ruby

Ajax On Rails w/Justin Gehtland

Are we still at the point where a talk on ajax must start with the "What is ajax?" question? Well, at least the explanations seem to be getting shorter Justin spent the majority of the presentation showing uncluttered examples of … Continue reading

Leave a Comment

Filed under ajax, rails, Ruby, Uncategorized

RailsConf – Day 1

Rob and I woke up early and made the trip to Chicago for RailsConf. The conference has the general feel of other Jay Zimmerman directed conferences I've attended. Following a fairly brief welcome from Chad Fowler, Rich Kilmer and David … Continue reading

Leave a Comment

Filed under rails, Ruby

Nostalgia

I can tell you what I don’t miss about the Java -> Ruby switch… Ruby: 4.days.ago **** Java: Start with java.util.Date, then use the java.util.DateFormat to… no, wait. Um, I think you need a java.util.Calendar… so check out the API … Continue reading

1 Comment

Filed under rails, Ruby

Remove A Shared Cookie

What's the worst part of making cookies? Cleaning up. Initially, I had set up code to set a cookie in the simplest fashion possible: cookies[:my_cookie] = {:value => 'test', :expires => 1.year.from_now} Cleanup was a snap: cookies.delete :my_cookie That was … Continue reading

Leave a Comment

Filed under Cookies, rails, Ruby