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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
On Sep 15, 2012, at 2:01 AM, daynthan kabilan wrote:> 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])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> end > > can anyone help me thanks for advance > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > > <Screenshot at 2012-09-15 11:37:21.png><Screenshot at 2012-09-15 11:37:56.png>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.