views:

21

answers:

1

I need an array with the column names of a table

Any ideas how I can do this with rails 3.0.0rc?

A: 

suppose you have a Post model:

Post.columns.map {|c| c.name }

it will return an array with column names of the table 'posts'

apeacox