Reputation: 5141
Course.find(:all, :group =>:id, :order => 'updated_at DESC', :joins=> :students :conditions => { :students => { :first_name=>"John", :status => 1}})
looking this query, passing the conditions as a hash, there is a way to:
Upvotes: 0
Views: 818
Reputation: 7510
Natively, there is not a way of which I am aware. There is ar-extensions which extends the finders with many things, including negating.
:conditions => { :students => { :first_name_not => "John"}}
:conditions => { :students => { :first_name_not => nil}}
Fair warning, last update I see for it is a year ago and support is limited to postgre, mysql and sqlite. This is the only active project I am aware of that extends activerecord in this way. Thoughtbot had squirrel, which you might be able to find some active forks for.
Upvotes: 1