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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---