Hi guys..
I have a problem with a scope for one of my models.
The models a roughly like this:
class Event
fields do
attendees_needed :integer
end
has_many :event_attendees, :dependent => :destroy
has_many :attendees, :through => :event_attendees, :accessible =>
true
end
class EventAttendee
belongs_to :event
belongs_to :user
lifecycle do
state :available, :volunteer, :manager
end
named_scope :attending, :conditions => { :state => ["volunteer",
"manager"], }
end
I need to scope the events for which that does not have sufficient
attendees. I've made a scope in EventAttendee that returns the
attendees that are actually attending, so i need to compare this count
with the attendees_needed integer, all resulting in a scope for the
Event model.
But i cannot get my head around doing that, so help is very much
appreciated..
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.