You learn something new everyday
I reaffirmed this morning my previous habit of using console-printing as a debugging method. In trying to ferret out the FlexTimes problem (see yesterday's post), I found that part of my logic was flawed in the
Oh yes, and the bug(s) described in yesterday's posts are fixed. Go ahead and use 1.5... I know I will!
write_attribute
. Here's a snippet that doesn't work:case column.klass # the AR column typeHere's the replacement that does:
when Date
@attributes[attr_name] = Date.today.to_hash.update(value).to_date
when Time
@attributes[attr_name] = value.to_time
else
@attributes[attr_name] = value
end
if column.klass == DateVery subtle difference, but it makes me wonder if I'm not understanding Ruby's
@attributes[attr_name] = Date.today.to_hash.update(value).to_date
elsif column.klass == Time
@attributes[attr_name] = value.to_time
else
@attributes[attr_name] = value
end
case
statement correctly. Does it actually check for equality of the when
argument to the case
argument? Anyone who could elucidate this would receive my eternal gratitude.Oh yes, and the bug(s) described in yesterday's posts are fixed. Go ahead and use 1.5... I know I will!