# "value must be enumerable" exception when using a sweeper?

**URL:** <https://www.ruby-forum.com/t/value-must-be-enumerable-exception-when-using-a-sweeper/127196>\
**Category:** Rails\
**Created:** [January 26, 2008, 1:39am UTC](https://www.ruby-forum.com/t/value-must-be-enumerable-exception-when-using-a-sweeper/127196 "2008-01-26T01:39:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlopke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@mlopke](https://www.ruby-forum.com/u/mlopke)\
**Post date:** [January 26, 2008, 1:39am UTC](https://www.ruby-forum.com/t/value-must-be-enumerable-exception-when-using-a-sweeper/127196/1 "2008-01-26T01:39:56Z")

</div>

Folks,

I’m going slightly crazy here - I implemented a Sweeper in an older app  
and used nearly the same exact code in my new app, yet I keep getting  
this ‘value must be enumerable’ exception. Even after I cut most of the  
code away, I still get the error. If anyone can help, I would be much  
obliged.

Notes: I’m using Engines… wonder if that could cause a problem. And  
yet, if I ‘observe’ my User model, which is part of my main app and not  
an engine or plugin, it still gives me the same exception.

Thanks!

* * *

application.rb:

cache\_sweeper :commerce\_sweeper

* * *

commerce\_sweeper.rb:

class CommerceSweeper \< ActionController::Caching::Sweeper  
observe Product

def after\_save(record)  
end  
end

* * *

exception:

C:/dev/ruby/lib/ruby/1.8/set.rb:275:in `+' C:/dev/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/observer.rb:149:in`initialize’  
C:/dev/ruby/lib/ruby/1.8/singleton.rb:95:in `new' C:/dev/ruby/lib/ruby/1.8/singleton.rb:95:in`instance’  
C:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action\_controller/caching.rb:570:in  
`cache_sweeper' C:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/caching.rb:568:in`each’  
C:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action\_controller/caching.rb:568:in  
`cache\_sweeper’  
C:/dev/workspace/BocueCommerce/app/controllers/application.rb:12
