The associations were fine. I did find a way to implement my ratings
system and it works solidly. I built everything in the models and now I
only use rake files for task/procedure initialization. The models all
house the meat of my routines/methods for calculations.
--
Posted via http://ww
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üë <
rails-mailing-l...@andreas-s.net> 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
> class TsosSpecialTeams < ActiveRecord::Base
> belongs_to :team
> end
.. is actually supposed to read:
class TsosSteams
belongs_to :team
end
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribe
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
Rick,
I was also looking at your example - this is what I would like to do:
schedules = Schedule.find(:all, :joins => [:team, :opponent,
:tsos_offense], :order => :team_id)
schedules.each do |schedule|
val = 0
schedule.opponents.each do |opponent|
if opponent.id == nil
val += 0.25
Hi Rick,
I want to do it exactly the way you are saying but I think I'm just a
bit confused here.
Let me show you what I'm working with now:
schedules = Schedule.find(:all, :joins => [:team, :opponent], :order =>
:team_id)
schedules.each do |schedule|
puts "Name = #{schedule.team.name} and
Why don't you just set the model up where you find "Teams" and each
Team has a collection of Team objects called 'opponents'? It would
seem to be a lot easier to me this way.
On Mon, Jul 20, 2009 at 9:07 AM, Älphä
Blüë wrote:
> That shows me all the team_ids listed in the schedules table. Now w
Okay I just want to make sure I understand this better.
schedules = Schedule.find(:all)
schedules.each do |schedule|
puts "Team Id = #{schedule.team_id}"
end
That shows me all the team_ids listed in the schedules table. Now what
if I want to iterate through those team_ids and collect all of
Thanks guys - I'm going to look at cleaning this up a bit. The 120
stems from the fact that there will always be exactly 120 teams (well
until the year 2012-2013) when South Alabama joins Div. 1.
My initial problem started when I didn't understand how to organize two
arrays into a hash of has
Älphä Blüë wrote:
[...]
> Providing the methods as is, with a brief idea of what data is
> returned..
I don't have time to review all these in depth, but:
>
> open_schedule = Schedule.new
> opp_scheduled_ids = []
> 120.times do |i|
Why are you hard-coding the value 120?
> opp_scheduled_ids[i
On Sun, Jul 19, 2009 at 10:01 PM, Älphä Blüë
wrote:
>
> http://pastie.org/551660
>
>
I haven't investigated all of this, and I'm coming from a Java/Groovy
background and new to Rails, but when I see 120.times to me it throws
up a red flag. Can't you make this more OO? For example I would think
y
Not sure if anyone is reading any of this, but figured I would update it
to show what things I'm doing to try and resolve my own code and clean
it up.
First, I took a step back and realized I was doing too much in my rake
file, and not enough in the model. So, all I have in my rake file for
http://pastie.org/551660
I added a pastie of the current rake file task (yep still working on a
procedural piece for ratings automation), along with the model (in full
for schedules) etc.
A brief idea of how it works and what I don't like about it...
In order to obtain a ratings schedule of s
13 matches
Mail list logo