Id NOT IN (?)

Hi i have 2 table users and issues

I need daily report . all users are give a status to everyday. i got it
in
2 line.
But i need leave users also.
If i use 1st def method i got user status list and all users no record
fields.

when i used the 2 nd def method i got user status list only.

i attached my 2 def methods and the 2 screen shot also here

 def report
         @issues=Issue.find(:all, :conditions => ['DATE(created_on) 

=
?’, Date.today])
issues = Array.new
@issues.each do |iss|
issues << iss.author_id
end
@users = User.find(:all, :conditions=>“id not in
(’#{issues}’)”).reverse
end

def report
@issues=Issue.find(:all, :conditions => ['DATE(created_on)

?’, Date.today])
@users = User.find(:all, :conditions => [“id NOT IN (?)”,
@issues])
end

can anyone help me thanks for advance

On Sep 15, 2012, at 2:01 AM, daynthan kabilan wrote:

 def report
         @users = User.find(:all, :conditions => ["id NOT IN (?)", @issues])

Try this:

@users = User.where("id NOT IN (?)", @issues.map(&:id))

Are you using Rails 2.3 or 3 or 3+? I think the find(:all) is deprecated
after 2.3.

Walter

Dear Walter

sorry for the delay reply.

am using rails 2.3.11 am using your condition by

@users = User.find(:all, :conditions=>[“id NOT IN (?)”,
@issues.map(&:id)])

that time also i got both output

and i got the correct output for this condition.

:conditions=>[“id not in (?)”,issues]

and thanks for your reply.

Regards,
Daya.S