Hi, I seem to be getting errors on a find method call that I dont understand. I have the model class Client < User has_many :campaigns has_many :codes, :through=>:campaigns has_many :code_hit_totals, :through=>:codes and I am trying the code cnt client.code_hit_totals.find(:all, :conditions=>["code_hit_totals.month = ? AND code_hit_totals.year = ?", date.month, date.year]) However If I get each code_hit_total they are all there. i.e client.code_hit_totals.each do |cht| --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I seem to be getting errors on a find method call that I dont understand. I have the model class Client < User has_many :campaigns has_many :codes, :through=>:campaigns has_many :code_hit_totals, :through=>:codes and I am trying the code cnt client.code_hit_totals.find(:all, :conditions=>["code_hit_totals.month = ? AND code_hit_totals.year = ?", date.month, date.year]) However If I get each code_hit_total they are all there. i.e client.code_hit_totals.each do |cht| puts cht.inspect end --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I never mentioned the error I get. It looks like this wrong number of arguments (2 for 1) points to app/models/report.rb:179:in `find'' On 6 Aug, 13:49, Iain Adams <aca04...-3Ch7lUbXYW61Qrn1Bg8BZw@public.gmane.org> wrote:> Hi, > > I seem to be getting errors on a find method call that I dont > understand. > > I have the model > > class Client < User > has_many :campaigns > has_many :codes, :through=>:campaigns > has_many :code_hit_totals, :through=>:codes > > and I am trying the code > > cnt > client.code_hit_totals.find(:all, :conditions=>["code_hit_totals.month > = ? AND code_hit_totals.year = ?", date.month, date.year]) > > However If I get each code_hit_total they are all there. > > i.e client.code_hit_totals.each do |cht| > puts cht.inspect > end--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/6/07, Iain Adams <aca04iba-3Ch7lUbXYW61Qrn1Bg8BZw@public.gmane.org> wrote:> > I never mentioned the error I get. It looks like this > > wrong number of arguments (2 for 1) > > points to > > app/models/report.rb:179:in `find''And what''s line 179 look like? -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---