software, business, and fun
cambodia

Ruby scripting for estimating the age of some models (AR data, not human, models)

Project had a model without a timestamp field, but we needed to figure out (roughly) how old each one was. They needed a report of their age to make them pay up - the model was for paid advertisers.

Best fit was to find when their logo was last updated. That day will be at least since they were entered online, and in general pretty close to the original date.

Advertiser.find(:all).each do |a|
if a.logo
puts "#{a.market.name} - #{a.name}:" + File.mtime(a.logo.full_filename).to_s
end
end

0 comments

There are no comments yet...

Kick things off by filling out the form below.

Leave a Comment