Rolling Windows and Sticky Bytes

<tagline type="clever"/>

Magic Timestamps and Join Tables

on 2012-07-28

…don’t mix.

If you’re creating a join table in Rails for a has_and_belongs_to_many relation, be sure that you don’t include t.timestamps to set up magic timestamps. When setting up the timestamps fields in the database¬†(created_at, etc.), Rails establishes a NOT NULL constraint and since the timestamp magic doesn’t happen, adds across the join will fail.


Leave a Reply

Your email address will not be published. Required fields are marked *