From: Brian Candler Date: 2008-12-17T06:22:50+09:00 Subject: Re: How to cycle through an instance Tom Ha wrote: > I have an instance of an object in my database and need to get out every > element of it, like this: > > Example: model = student > ======================== > > firstname = Fred > lastname = Williams > streetname = NULL > city = NULL > date of birth = 12.12.1934 > ... > (until there is no more column name left for this model) > > How do I correctly/efficiently cycle through this one? Depends on what ORM you are using. If it's ActiveRecord, try obj.attributes (ActiveRecord questions probably best asked on the Rails mailing list though) -- Posted via http://www.ruby-forum.com/.