search for: the_on

Displaying 1 result from an estimated 1 matches for "the_on".

Did you mean: the_orn
2009 Sep 28
6
What is the most efficient way to split a table into 2 groups?
...e record.id = blah and then all the (rest of the) records where record.id <> blah? Is it more efficient to grab all the records at once and write some ruby code to select the one record from the rest? If so, what would that code look like? I don''t like this: everything = Part.all the_one = everything.select {|x| x.id == 2} the_rest = everything.reject {|x| x.id != 2} That''s going to iterate over all of the records. twice! in interpreted code! Any thoughts, ideas, or snide remarks? --wpd