# How to reuse named scope conditions with eager loading

**URL:** <https://www.ruby-forum.com/t/how-to-reuse-named-scope-conditions-with-eager-loading/162674>\
**Category:** Rails\
**Created:** [March 12, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/how-to-reuse-named-scope-conditions-with-eager-loading/162674 "2009-03-12T17:38:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [March 12, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/how-to-reuse-named-scope-conditions-with-eager-loading/162674/1 "2009-03-12T17:38:38Z")

</div>

Hi,

I’ve got Channel model that has many events. Event belongs to channel  
and additionally has a named scope called “current”.

I need to iterate over each channel and then over each “current” event  
for given channel i.e.:

@channels.each do |channel|  
channel.events.current do |event|  
…  
end  
end

I could do

@channels = Channel.all(:include =\> :events, :conditions =\>  
“events.end\_time \>…”)

but the problem is that the conditions would be exactly the same as  
already specified for the “current” scope in Event model. Is it  
somehow possible to reuse them here?
