Displaying 3 results from an estimated 3 matches for "league_id".
2006 Jan 09
3
Include with two references of one model of the same table
...sample of the error...
|PGError: ERROR: table name "matches" specified more than once
: SELECT matches."awayteam_goals" AS t2_r1, matches."season_id" AS t1_r7, teams_seasons."division_id" AS t0_r6, matches."hometeam_goals" AS t2_r2, matches."league_id" AS t1_r8, matches."awayteam_id" AS t2_r3, matches."venue_id" AS t1_r9, matches."hometeam_id" AS t2_r4, matches."matchtime_start" AS t2_r5, matches."id" AS t1_r0, matches."matchtime_stop" AS t2_r6, matches."awayteam_goals" A...
2008 Feb 15
3
Destroy, dependent and performance
...vitations,:source =>
:user,:conditions => "accepted == ''t''"
end
First of all:
Leagues and invitations are dependent as you can see in the model. When
I destroy a League the SQL generated is this:
[DEBUG] Invitation Load SELECT * FROM invitations WHERE
(invitations.league_id = 1)
[DEBUG] Invitation Destroy DELETE FROM invitations WHERE "id" = 12
[DEBUG] Invitation Destroy DELETE FROM invitations WHERE "id" = 15
If you have 100 invitations, you have to do 101 db calls?
I think it will be better to just make a
DELETE FROM invitations WHERE league_id...
2008 Jun 15
7
Getting "no block given" on find method - rails 2.1
I am trying to do a simple find through the current_user but get an
exception. Either someone spiked my Starbucks coffee and I am screwing
up all over the place or there is something wrong.
def index
@league = current_user.leagues.find(13)
end
# Error
LocalJumpError in Admin/schedule todosController#index
no block given
If I pass a block to it it works fine, but it is just messy:
=====