How to query data without create model in Rails?

Viewed 5082

Sometimes, I need to query lots of data in DB for data processing.

For example, I have a table: Activity, I want to find all the users which create activity in the last month,

I am only concerned about the data arrays, and I don't want to create a lot of Activity models,

Is there any way I can do it?

like this code:

Activity.where('created_at > ?', Time.now - 1.month).get_data(:user_id, :created_at)
=> [[1, 2012-02-01] .... ]
2 Answers
Related