Forum: Ruby on Rails Associations

Posted by Sumit Srivastava (Guest)
on 2013-02-08 06:49
(Received via mailing list)
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
Posted by Colin Law (Guest)
on 2013-02-08 10:21
(Received via mailing list)
On 8 February 2013 05:47, Sumit Srivastava
<sumit.theinvincible@gmail.com> 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
Posted by pravin vaja (Guest)
on 2013-02-08 17:20
(Received via mailing list)
Hi,

  You have to make player_id as foreign key in PlayerScore model and it
will work.

Regards,
vajapravin
Posted by sumit srivastava (Guest)
on 2013-02-20 06:53
(Received via mailing list)
On 8 February 2013 15:53, pravin vaja <vajapravin23@gmail.com> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.