Retrieving data in a time range with rails

I’m writing this mostly as a reminder to myself, since I keep forgetting this :)

Instead of:

widgets = Widget.where("? <= created_at AND created_at <= ?", time_from, time_to)

do this:

widgets = Widget.where(:created_at => time_from .. time_to)