Philip Hallstrom wrote:

>> also, the use of i[0], i[1] seems a little less structured than if 
>> i.attr_name, i.attr_value can be used.
> 
> look into "s.attributes.each_pair |k,v|"
> 
> 
>> the row == 1 situation also seems like somewhat not adhering to DRY.
> 
> You could consider using Story.column_names to print out the header and 
> then using that to loop through and print out each object's 
> attributes...
> 
> -philip

yes, column_names gave a better order:

C:\Software Projects\ror\shov10>ruby script/console
Loading development environment (Rails 2.3.5)
>> Story.column_names
=> ["id", "name", "link", "created_at", "updated_at"]

s.attributes came in the order of:

name  created_at  updated_at  id  link

with the primary index somewhere in the middle.
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to