I'm trying to solve a seemingly simple AR problem I'm having. I can't figure out how to return a list of events that have 1 or more attendees, and the docs examples use cache_control which I don't want to use.
I have a simple event model with a has_many relationship:
class Event < ActiveRecord::Base
  has_many :attendees
end
and an attendees model that belongs to event
class Attendees < ActiveRecord::Base
  belongs_to :event
end
But some events will have 0 attendees. So what's the ActiveRecord way of doing this without using cache_control or writing a custom SQL statement?
It seems like it would be something like:
Event.where(attendees.count > 0)
but I keep getting a column error.
 
     
     
     
    