Hi, I have a model PlayerScore with unique key as (dt, player_id). I have create associations between Player model and PlayerScore model to display the score on Player screen. Had it been just the score_id as the foreign_key a simple association with belongs_to and has_one would have helped. How should I proceed in this case? Regards, Sumit -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/DJI-kL04WtoJ. For more options, visit https://groups.google.com/groups/opt_out.
On 8 February 2013 05:47, Sumit Srivastava <sumit.theinvincible-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I have a model PlayerScore with unique key as (dt, player_id). I have > create associations between Player model and PlayerScore model to display > the score on Player screen. Had it been just the score_id as the foreign_key > a simple association with belongs_to and has_one would have helped. How > should I proceed in this case?I cannot understand what your question is, please ask again with a bit more detail. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Hi, You have to make player_id as foreign key in PlayerScore model and it will work. Regards, vajapravin On Friday, 8 February 2013 11:17:41 UTC+5:30, Sumit Srivastava wrote:> > Hi, > > I have a model PlayerScore with unique key as (dt, player_id). I have > create associations between Player model and PlayerScore model to display > the score on Player screen. Had it been just the score_id as the > foreign_key a simple association with belongs_to and has_one would have > helped. How should I proceed in this case? > > Regards, > Sumit >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/uVWfHoZxlHwJ. For more options, visit https://groups.google.com/groups/opt_out.
On 8 February 2013 15:53, pravin vaja <vajapravin23-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > You have to make player_id as foreign key in PlayerScore model and it > will work. > > Regards, > vajapravin > >Hi Pravin, This helped but the data being returned is that of earliest date. I need the latest one. How to do that? Thanks, Sumit> > On Friday, 8 February 2013 11:17:41 UTC+5:30, Sumit Srivastava wrote: >> >> Hi, >> >> I have a model PlayerScore with unique key as (dt, player_id). I have >> create associations between Player model and PlayerScore model to display >> the score on Player screen. Had it been just the score_id as the >> foreign_key a simple association with belongs_to and has_one would have >> helped. How should I proceed in this case? >> >> Regards, >> Sumit >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/uVWfHoZxlHwJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.