Using find by sql to get some results. The error is:
wrong number of arguments (0 for 1)
#{RAILS_ROOT}/app/models/result.rb:24:in `find_by_sql''
def self.get_tests_run(project)
@project = Project.find(project)
@builds = []
@results = []
@project.testsuite.each do |testsuite|
testsuite.build.each do | build|
@builds << build.id
end
end
now = Date.today
count = 7
7.times do
@results << Result.find_by_sql["SELECT count(distinct(tcid)) FROM
results WHERE build_id in (?) and daterun <= ?", @builds,
Date.new(now.year,now.month,now.day - count) ]
count -= 1
end
@results
end
I cannot see what is wrong with that find_by_sql statement.
thanks
RJ
--
Posted via http://www.ruby-forum.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
-~----------~----~----~----~------~----~------~--~---
Missing parentheses around the argument. You have square brackets for the SQL parameter substitution but no () for the argument list. Neha Chopra wrote:> > > Using find by sql to get some results. The error is: > > wrong number of arguments (0 for 1) > #{RAILS_ROOT}/app/models/result.rb:24:in `find_by_sql'' > > def self.get_tests_run(project) > @project = Project.find(project) > @builds = [] > @results = [] > @project.testsuite.each do |testsuite| > testsuite.build.each do | build| > @builds << build.id > end > end > now = Date.today > count = 7 > 7.times do > @results << Result.find_by_sql["SELECT count(distinct(tcid)) FROM > results WHERE build_id in (?) and daterun <= ?", @builds, > Date.new(now.year,now.month,now.day - count) ] > count -= 1 > end > @results > end > > I cannot see what is wrong with that find_by_sql statement. > > thanks > > RJ > > -- > Posted via http://www.ruby-forum.com/. > > > > >-- View this message in context: http://www.nabble.com/Can-anyone-see-what-is-wrong-with-this-code--tf3454521.html#a9638351 Sent from the RubyOnRails Users mailing list archive at Nabble.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 -~----------~----~----~----~------~----~------~--~---