Thanks koz!

Fred
On 11 Nov 2008, at 00:04, Frederick Cheung wrote:

> I've got a tiny change to active record that seems almost too small  
> to dignify with a ticket (but do let m know if I should):
>
> From 00cfd46587c1459fc818fadd056805530545eddd Mon Sep 17 00:00:00 2001
> From: Frederick Cheung <[EMAIL PROTECTED]>
> Date: Tue, 11 Nov 2008 00:02:11 +0000
> Subject: [PATCH] Remove unneeded uniq - hash keys are already unique!
>
> ---
> .../lib/active_record/association_preload.rb       |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/activerecord/lib/active_record/association_preload.rb b/ 
> activerecord/lib/active_record/association_preload.rb
> index 6e194ab..69300e5 100644
> --- a/activerecord/lib/active_record/association_preload.rb
> +++ b/activerecord/lib/active_record/association_preload.rb
> @@ -312,7 +312,7 @@ module ActiveRecord
>           table_name = klass.quoted_table_name
>           primary_key = klass.primary_key
>           column_type = klass.columns.detect{|c| c.name ==  
> primary_key}.type
> -          ids = id_map.keys.uniq.map do |id|
> +          ids = id_map.keys.map do |id|
>             if column_type == :integer
>               id.to_i
>             elsif column_type == :float
> -- 
> 1.6.0.1
>
>
> The uniq here is useless - by definition the keys in a hash are unique
>
> Fred


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to