Tech Talk

Bytefull of Tech Talk (http://tech.bytefull.com)

Rails oddity: created_at not auto-updated in fixtures

Today I discovered the following Rails oddity.

Models created in a test fixture don’t have their created_at attributes auto-updated. They need to be specified like this:

created_at: <%=Time.now.to_s(:db)%>

Thanks to toretore on #rubyonrails (irc.freenode.net) for this tip.

June 12th, 2007 | ahsan | Code, Rails

One Response to “Rails oddity: created_at not auto-updated in fixtures”

  1. AnĂ­bal Rojas Says:

    Nice tip, we are still using fixtures for some specs and this trick is helpfull. Welcome to RubyCorner

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.