Associating a query with a active record class


Is there a way by which i can associate a complex query with a Model
class without using a VIEW, so that i can access all the names of the
columns returned by the query.


Oops sorry found the solution had to use .attributes to get a hash of
the column name with value