Skip to content

Instantly share code, notes, and snippets.

@gravis
Created October 22, 2010 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gravis/640183 to your computer and use it in GitHub Desktop.
Save gravis/640183 to your computer and use it in GitHub Desktop.
>> Event.find(123).participants.ascend_by_number
[works]
>> Event.find(123).participants.published.all(:order => :number)
[works]
>> Event.find(123).participants.published.ascend_by_number
[returns the whole table until memory is full and server crash]
SQL :
SELECT * FROM "events" WHERE ("events"."id" = 123)
SELECT * FROM "participants" WHERE ("participants"."published" = 't') ORDER BY participants.number ASC
=> the WHERE event_id is gone !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment