In my Rails 2 application, a method will receive an arbitrary result set from a find operation, where only a subset of the potential columns will have been returned.
How can I determine, from the resultant objects only, which columns were selected in the find query?
columns won’t help, as that returns all the columns in the table…
You can determine these by using the
attribute_namesmethod on any object from the result set.