# HI guys.... I have an articles table with fields as id,ti

**URL:** <https://www.ruby-forum.com/t/hi-guys-i-have-an-articles-table-with-fields-as-id-ti/113812>\
**Category:** Rails\
**Created:** [September 5, 2007, 6:50am UTC](https://www.ruby-forum.com/t/hi-guys-i-have-an-articles-table-with-fields-as-id-ti/113812 "2007-09-05T06:50:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhonny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jhonny](https://www.ruby-forum.com/u/jhonny)\
**Post date:** [September 5, 2007, 6:50am UTC](https://www.ruby-forum.com/t/hi-guys-i-have-an-articles-table-with-fields-as-id-ti/113812/1 "2007-09-05T06:50:19Z")

</div>

HI guys…

I have an articles table with fields as id,title, . . . and  
users table with id,name, . . . and i can join this table to put a  
through relation with readings table(A kind of join) with fields as  
id, article\_id, user\_id, read\_at, rating.

The relations will be like the below  
class Article \< ActiveRecord::Base  
has\_many :readings  
end

class User \< ActiveRecord::Base  
has\_many :readings  
end

class Reading \< ActiveRecord::Base  
belongs\_to :article  
belongs\_to :user  
end

But the thing is i have a user, reading an article several times. So  
when i am listing, it will show three entries of an user for three  
readings. So i will use one of the two method  
options :unique, :select=\>“distinct.BlahBlah” to not repeat. So that  
must make me to not have the repetitions. But my concern here is  
regarding the ratings and the other field in my third table. The user  
may have read an article three times but each and every time he might  
have rated that article with different entries.

So if i unique the readings what will be the rating considered to  
my rated\_at.

Thanks In advance…
