select method on ActiveRecord::Relation brakes enumeration

class Brake   scope :good, where(:quality => 'good') end

Brake.all.select &:nil? #=> works fine Brake.good.select &:nil? #=> FAILS

Last statement fails because Brake.good.select is returning ActiveRecord::Relation and not an array.

I have posted a detailed discussion on ticket #4589 . https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4589-issues-with-scopesassociation-proxies-lazyenum-behavior#ticket-4589-4

Would love to hear thoughts from others.

class Brake scope :good, where(:quality => 'good') end

Brake.all.select &:nil? #=> works fine Brake.good.select &:nil? #=> FAILS

Last statement fails because Brake.good.select is returning ActiveRecord::Relation and not an array.

I have posted a detailed discussion on ticket #4589 . #4589 Issues with scopes/association proxies lazy/enum behavior ... - Ruby on Rails - rails

Would love to hear thoughts from others.

If you want to explicitly call an Array/Enumerable method on a Relation, convert it to one first, by using #to_a. I don't think this is a problem, just something that is expectable but you should remember.

Cheers, -foca