I've been busy the past two days. How have things worked out with all this?

On Mon, Jul 20, 2009 at 11:01 AM, Älphä Blüë <
[email protected]> wrote:

>
> Let me take a step back here and look over my associations:
>
> Are they setup incorrectly?
>
> I want team to be my core object always..
>
> class Team < ActiveRecord::Base
>  has_many  :schedules
>  has_many  :inheritance_templates
>  has_many  :opponents,  :through => :schedules
>  has_many  :tsos_offenses
>  has_many  :tsos_defenses
>  has_many  :tsos_steams
>  has_many  :tsos_turnover_margins
>  has_many  :tsrs_ratings
> end
>
> I want schedule to be a part of teams and also to be a part of opponent
> (self-referential) through Team..
>
> class Schedule < ActiveRecord::Base
>  belongs_to  :team
>  belongs_to  :opponent, :class_name => "Team"
> end
>
> These two pieces alone should give me associations between Team >
> Schedule > Opponent.
>
> My ratings tables all belong to team:
>
> class TsosOffense < ActiveRecord::Base
>  belongs_to  :team
> end
> class TsosDefense < ActiveRecord::Base
>  belongs_to  :team
> end
> class TsosSpecialTeams < ActiveRecord::Base
>  belongs_to  :team
> end
> class TsosTurnoverMargin < ActiveRecord::Base
>  belongs_to  :team
> end
>
> Everyone and everything I read, including you both (Rick and Marnen) say
> that large queries are much better than smaller queries.
>
> What if I want to query everything from all models listed here, assign
> them to a team object so that I can reference them by the team object.
> How would I do that?
>
> If I have the answer to this one question, I think I can fix all of the
> current issues I'm experiencing.
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
Rick R

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to