# How to get associated fields

**URL:** <https://www.ruby-forum.com/t/how-to-get-associated-fields/183345>\
**Category:** Rails\
**Created:** [February 12, 2010, 6:12am UTC](https://www.ruby-forum.com/t/how-to-get-associated-fields/183345 "2010-02-12T06:12:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [February 12, 2010, 6:12am UTC](https://www.ruby-forum.com/t/how-to-get-associated-fields/183345/1 "2010-02-12T06:12:31Z")

</div>

Dear all,

Model.column\_names gives all the fields in the table.

But it doesnot show the associated fields value.

my model is associated with has\_and\_belongs\_to\_many :groups

how can i get the associated fields also…

Any helps …

Thank you

---

<div class="post-metadata">

**Author:** ![newb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/2acd7d/32.png) [@newb](https://www.ruby-forum.com/u/newb)\
**Post date:** [February 12, 2010, 8:08am UTC](https://www.ruby-forum.com/t/how-to-get-associated-fields/183345/2 "2010-02-12T08:08:51Z")

</div>

On Feb 12, 1:12 pm, Newb N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Any helps …
> 
> ## Thank you
> 
> Posted viahttp://www.ruby-forum.com/.

You can get all the associations via reflections:

Model.reflect\_on\_all\_associations

HTH
