Forum: Ruby on Rails Incorrect number of arguments.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C728d93eb5205cf20cac0c2928b0ad62?d=identicon&s=25 Jeff Jones (rurounijones)
on 2006-01-19 15:51
Hello all. I have the following code in a partial. It's purpose is to
create a dropdown box with a bunch of values in it for display purposes
only.

(@bugsheet is an instance variable being used by the partial)

<%= select("bugclientlink", "bug_id",
Bugclientlink.listclients(@bugsheet.id))

Given the fact that Bugclientlink class contains:

def self.listclients( reference )
    result = Bugclientlink.find_by_sql["select client_ref from
bugclientlink         where bug_id = ?", reference ]
    result.push(Bugclientlink.new('99999', '                 '))
  end
end

Can anyone tell me why is it giving me the following error?

Many thanks in advance, I am sure it is something simple I am missing
(The joys of being a nub!)

Jeff

---------------------------------------------------------------

Showing app/views/bugsheet/_display.rhtml where line #31 raised:

wrong number of arguments (0 for 1)

Extracted source (around line #31):

28:   </div>
29:   <div class="row">
30:     <span class="label"><label for="bugsheet_bs_formname">Reported
By</label></span>
31:     <span class="first"><%=  select("bugclientlink", "bug_id",
Bugclientlink.listclients(@bugsheet.id)) %></span>
32:   </div>
33:     <div class="row">
34:     <span class="label"><label for="bugsheet_bs_assign">Team
Leader</label></span>

Trace of template inclusion: /app/views/bugsheet/show.rhtml

RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace

#{RAILS_ROOT}/app/models/bugclientlink.rb:5:in `find_by_sql'
#{RAILS_ROOT}/app/models/bugclientlink.rb:5:in `listclients'
#{RAILS_ROOT}/app/views/bugsheet/_display.rhtml:31
#{RAILS_ROOT}/app/views/bugsheet/show.rhtml:2
-e:3:in `load'
-e:3
This topic is locked and can not be replied to.