how to check database's queries?

try log/development.log

distance_of_time_in_words(@object.created_at, Time.now), for instance.

Take a look at the method source to see how they do it.