From: Dave Burt Date: 2005-09-04T23:06:27+09:00 Subject: Re: ruby / rails newbie - Finding documentation in RDocs James Britt offered: > steveH wrote: >> <% for column in Product.content_columns %> >> <%= column.human_name %> >> <% end %> >> >> but I can't find a description of class Column anywhere - can't see it >> in rails docs, core ruby docs, MySQL/Ruby docs - have I just missed it >> or is it somewhere else, or isn't it a class at all but some sort of >> dynamic ruby magic which I've totally misunderstood... > > In the construct > > for x in some.collection > ... > end > > x is a variable that takes on the file of each successive item in > collection. > > See [...] James is right, there is no explicit type or class set for column, or indeed any Ruby variable. All Ruby variables have the dynamic ruby magic property of being able to hold an object of any type. Here's some trivia realted to your question, though. For most or all of the connection adapters, content_columns will return an Array of Column, a.k.a. ActiveRecord::ConnectionAdapters::Column, which is a class in Rails, but doesn't appear in the API docs. It has properties: name, default, type and limit. You can read the source code for ConnectionAdapters, the AbstractAdapter, and the adapter for your database if you want to know more. Cheers, Dave