How to do the following in Rails 3?
CREATE TEMPORARY TABLE average_user_total_time (SELECT SUM(time) AS time_taken FROM scores WHERE created_at >= '2010-10-10' and created_at <= '2010-11-11' GROUP BY user_id); SELECT COUNT(*) from average_user_total_time WHERE time_taken > 60 and time_taken < 600
I tried to do something like
create_table (:average_user_total_time), :temporary=> true do |t| end
but not sure how to use it. I need to use it in my application, not in migration.
source share