# List of a Model attributes

**URL:** <https://www.ruby-forum.com/t/list-of-a-model-attributes/151935>\
**Category:** Rails\
**Created:** [October 28, 2008, 3:42am UTC](https://www.ruby-forum.com/t/list-of-a-model-attributes/151935 "2008-10-28T03:42:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fhb418](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/58f4c7/32.png) [@fhb418](https://www.ruby-forum.com/u/fhb418)\
**Post date:** [October 28, 2008, 3:42am UTC](https://www.ruby-forum.com/t/list-of-a-model-attributes/151935/1 "2008-10-28T03:42:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fhb418](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/58f4c7/32.png) [@fhb418](https://www.ruby-forum.com/u/fhb418)\
**Post date:** [October 28, 2008, 3:57am UTC](https://www.ruby-forum.com/t/list-of-a-model-attributes/151935/2 "2008-10-28T03:57:32Z")

</div>

There’s the annotate models plugin:  
[http://agilewebdevelopment.com/plugins/annotate\_models](http://agilewebdevelopment.com/plugins/annotate_models) . I don’t know  
whether it works with recent versions of Rails.

Regards,  
Craig

---

<div class="post-metadata">

**Author:** ![fhb418](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/58f4c7/32.png) [@fhb418](https://www.ruby-forum.com/u/fhb418)\
**Post date:** [October 28, 2008, 4:15am UTC](https://www.ruby-forum.com/t/list-of-a-model-attributes/151935/3 "2008-10-28T04:15:40Z")

</div>

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](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![fhb418](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/58f4c7/32.png) [@fhb418](https://www.ruby-forum.com/u/fhb418)\
**Post date:** [October 28, 2008, 10:51am UTC](https://www.ruby-forum.com/t/list-of-a-model-attributes/151935/4 "2008-10-28T10:51:55Z")

</div>

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
