To the gist, I'd add home_goals and away_goals columns to the Game model,
given the nature of the beautiful game. Your Post model would include
"belongs_to :game", and on the other side the Game would have "has_many
:posts". You'd then add a game_id column to the Posts table using a
migration.

Don't worry about having separate relationships for previews and reports on
that one, as presumably the fact that reports will go up after the game,
and previews before it, will sort things out (besides which: what about
post-match interviews, tactical analysis, injury lists etc, which might all
be attached to a game without really being one or the other? You may want
this kind of content later on, even if you don't to begin with).

In general, don't necessarily worry about getting everything in your models
right up front. Football may be a matter of 22 blokes kicking a pig's
bladder around, but there's a lot of info to keep track of these days (in
England at least, we seem to have contracted the sports statistics
addiction from the Americans). It's easy enough to add a column here and
there with a migration. Write some basic controllers/views for doing CRUD
operations on your core models, get the basic relationships in place and
into the browser, and iterate from there.


On Tue, Jan 14, 2014 at 8:52 AM, Thompson Edolo <[email protected]>wrote:

> Thanks for replying. I'm not really sure I know what a "Test
> fixture" is though. This is what I'm trying to do. The soccer league in my
> country doesn't have any true sites like ESPN Soccernet.com. I am trying to
> replicate that.
>
> I have a fixture model, it has a home_team column and an away_team column.
> These columns are supposed to be foreign keys to a Team model, I don't know
> how to set that up.
>
> Then I have a scheduled_at column and a played column that is a Boolean.
> I'd like a scenario where the fixtures/index shows all the matches for the
> present week with a calendar to browse future and past fixtures.
>
> Hopefully this would make my previous post a bit clearer.
>
> Thanks
>
> On Tuesday, January 14, 2014 8:16:12 AM UTC+1, tamouse wrote:
>>
>>
>>
>>
>> On Mon, Jan 13, 2014 at 6:44 PM, Thompson Edolo <[email protected]>wrote:
>>
>>> Hello everyone. I'm currently building a blog in Rails 4 to serve news
>>> from the local soccer league in my country. The news part has been a breeze
>>> but I have not been able to code the fixtures and result portion.
>>>
>>> I have been totally stumped as i don't even have an idea on how best to
>>> go about this. To make matters worse, I have to associate these
>>> fixtures/results to their respective pre-match previews and post-match
>>> reviews(I intend to make these normal post entries with a category).
>>>
>>> Please, I might not necessarily need actual codes. Pseudo codes would
>>> suffice.
>>>
>>> Thanks.
>>>
>>> PS: If you need more info about how i have the app setup, just ask.
>>> Thanks in advance.
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/rubyonrails-talk/f4e9cea4-a870-47b7-901e-
>>> 9a416db04234%40googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>> Are you talking about test fixtures here? Or something else? Test
>> fixtures are YAML files that load data into your database for testing.
>>
>> I'm also lso quite unclear what you mean to produce for results. It's too
>> generic a term. Do you mean match results? Displaying those seems like it
>> would be rather straight forward; the difficult thing would be obtaining
>> the data, unless you plan to enter it by hand from some other place.
>>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/cefc644c-d261-4320-bf6a-277c05650e20%40googlegroups.com
> .
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAAb4X%3DwrFF6v1FkJJpBQjWrEr8BZ8aoqG4HckGrUZHF5VvNtyw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to