Forum: Ruby on Rails List of a Model attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Phil G. (Guest)
on 2008-10-28 04:42
Hi,

I am just starting on Ruby and I would like to know if there is any
place in the code where I can get a Model attributes list ?

Of course I could look into the migration file or look at the DB tables,
but is there another way ?

Thanks
Craig D. (Guest)
on 2008-10-28 04:57
(Received via mailing list)
There's the annotate models plugin:
http://agilewebdevelopment.com/plugins/annotate_models . I don't know
whether it works with recent versions of Rails.

Regards,
Craig
boblu (Guest)
on 2008-10-28 05:15
(Received via mailing list)
Do you mean Model.column_names ?
You could just use it, and it will return an arry with all your column
names in your DB tables.

On Oct 28, 11:42 am, Phil Go20 <removed_email_address@domain.invalid>
Frederick C. (Guest)
on 2008-10-28 11:51
(Received via mailing list)
On 28 Oct 2008, at 02:42, Phil Go20 wrote:

>
> Hi,
>
> I am just starting on Ruby and I would like to know if there is any
> place in the code where I can get a Model attributes list ?
>
> Of course I could look into the migration file or look at the DB
> tables,
> but is there another way ?
>
Assuming you mean as a programmer (ie not with some code at runtime),
take a look at schema.rb in your app.

Fred
This topic is locked and can not be replied to.