Reputation: 1
I have a have_and_belong_to_many relationship between a Resources model and ResourceType model.
I am trying to find all resources that are joined by a ResourceType with the :name NOT equal to "event".
I have it working so that I can find Resources with ResourceType.names equal to "event" like this:
Resource.find(:all, :order => 'created_at DESC', :include => :resource_types, :conditions => {:resource_types => {:name => 'event'}})
but I want to find everything else with :name != 'event'.
Thanks for the help!
Upvotes: 0
Views: 239
Reputation: 83680
Resource.find(:all, :order => 'created_at DESC', :include => :resource_types, :conditions => ['resource_types.name != ?', 'event'])
Upvotes: 2