On Jul 11, 5:55 pm, "Älphä Blüë" <[email protected]>
wrote:
> > Creating a named scope on the fly like that is really rather odd (and
> > completely unnecessary). i'm also not sure why you don't just do
> > @schedule = team.schedules.find :all, :order => '...'
> > If you want you can add a named scope on schedules with the order you
> > want and do
>
> It was just some thrown together code - not staying like that
> permanently. I create named scopes mostly for pagination or for
> reusability in multiple methods.
Nothing wrong with named scopes, but typically you wouldn't create one
inside a method like that (just as you wouldn't create an association
in there either)
>
> > Why not put the team_id for the opponent in the schedules table ?
>
> I can't parse the schedules from ncaa.org so I'm having to enter every
> team's schedule by hand into the table initially.
>
> 120 teams x 12 rows = 1,440 team_ids..
>
> I would have to look up each team id manually in order to verify and
> place them in there. Whereas when I manually enter the data in right
> now, I simply am entering schedules via printouts. I would hate to have
> to verify 1,440 IDs but if that's the best way to do this then I will.
>
You could use one of the autocomplete plugins (or even something more
manual) that (at creation time) would look up the team id for you,
based on the name you entered.
> The name of the column would have to be different though. I can't have
> two team_id columns in my schedules table.
Of course not. but you could easily have a team_id column and an
opponent_id column
Fred
>
> I was really hoping there was a way to query the teams table and find
> the team_id for the name == opponent from the schedules table..
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---