I’ve read the rails book and wiki entries such as
As far as I can tell, the recommended way to display the author’s name
for a db of posts / authors is to use :include and then use
post.author.full_name to see the full_name column.
a) all columns of author are pulled down
b) Not clear to me how you’d cleanly iterate through the desired result
columns in the ‘post’ object since one of the desired columns is
(Any comments on the above?)
So IMHO, we need a ‘View’ subclass of ActiveRecord that takes a sql
statement and returns the result as an object. The resulting object
would support all of the read-only methods and properties of the usual
ActiveRecord db model objects.
It would be used when the db doesn’t support views. (Eg MySql v4.x)
Unfortunately, ActiveRecord::Base.connection.select_all sql only returns
an array of hashes. This could be better. Eg render partial/collection
will NOT step through the array elements (the rows).
==>> Comments? Anyone worked on this? Tips for me to start with?