# Active Record relations

**URL:** <https://www.ruby-forum.com/t/active-record-relations/185729>\
**Category:** Rails\
**Created:** [March 25, 2010, 9:02am UTC](https://www.ruby-forum.com/t/active-record-relations/185729 "2010-03-25T09:02:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mailtorajuit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@mailtorajuit](https://www.ruby-forum.com/u/mailtorajuit)\
**Post date:** [March 25, 2010, 9:02am UTC](https://www.ruby-forum.com/t/active-record-relations/185729/1 "2010-03-25T09:02:35Z")

</div>

HI all

in my application , i have 2 tables subjects and teachers. the relation  
is one to many.

i have to display the subjects first and when i click on the subjects i  
have to display the teachers.

and i have to add the new teacher to the teachers table by selecting the  
subject.

how to do this

---

<div class="post-metadata">

**Author:** ![mailtorajuit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@mailtorajuit](https://www.ruby-forum.com/u/mailtorajuit)\
**Post date:** [March 26, 2010, 6:36pm UTC](https://www.ruby-forum.com/t/active-record-relations/185729/2 "2010-03-26T18:36:08Z")

</div>

Hi Rajkumar,

This is pretty basic Rails â€“ it might be a good idea to study up on the  
Ruby  
on Rails guides [http://guides.rubyonrails.org/](http://guides.rubyonrails.org/) and the Agile Web  
Development with  
Rails[http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition](http://pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition)book.  
I hope this is okay for you.

/Lasse

2010/3/25 Rajkumar S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
