# How to insert value to the extra field in join model

**URL:** <https://www.ruby-forum.com/t/how-to-insert-value-to-the-extra-field-in-join-model/174547>\
**Category:** Rails\
**Created:** [August 28, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/how-to-insert-value-to-the-extra-field-in-join-model/174547 "2009-08-28T14:09:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akramwasim1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@akramwasim1234](https://www.ruby-forum.com/u/akramwasim1234)\
**Post date:** [August 28, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/how-to-insert-value-to-the-extra-field-in-join-model/174547/1 "2009-08-28T14:09:51Z")

</div>

hi all,  
consider that I’m having 3 models  
1)user  
2)doc  
3)udoc

user model=\>(id,name)  
has\_many:udocs  
has\_many:docs ,through:udocs

doc Model=\>(id,name)  
has\_many:udocs  
has\_many:users ,through:udocs

udoc Model=\>(id,user\_id,doc\_id,start\_date,end\_date)  
belongs\_to:user  
belongs\_to;doc

Can anybody just tell how to access the extra field (start\_date and  
end\_date) in udocs table  
by using User Model

---

<div class="post-metadata">

**Author:** ![akramwasim1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@akramwasim1234](https://www.ruby-forum.com/u/akramwasim1234)\
**Post date:** [August 28, 2009, 3:28pm UTC](https://www.ruby-forum.com/t/how-to-insert-value-to-the-extra-field-in-join-model/174547/2 "2009-08-28T15:28:53Z")

</div>

2009/8/28 Kart [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> by using User Model  
> Assuming you have a user in, say, @user, then @user.udocs will give  
> you an array of Udoc objects so you can do things like  
> @user.udocs[0].start\_date  
> or  
> @user.udocs.each do |udoc|

# do something with udoc.end\_date

end

Colin
