Jhonny
2007-Sep-05 04:49 UTC
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.
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.... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---