Forum: Ruby on Rails form.select wrong number of arguments (0 for 1)

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.
8cebb6913508306c81a2d90be55b216f?d=identicon&s=25 RailsNewby (Guest)
on 2007-05-10 01:21
I am new to rails, PHP background. I'm completely lost on this. I am
trying to pull all of the albums from the albums table into a select
box. But every time I run the script I get the "wrong number of
arguments (0 for 1)" error. I've looked on other message boards and
searched the web but I can't seem to find the answer. I've tried several
different variations of the form.select but they all lead to the same
error.

Oh, and I am using Instant Rails and this is a new application to this
install.

Here is the error:

 ArgumentError in Admin#index

Showing app/views/admin/index.rhtml where line #3 raised:

wrong number of arguments (0 for 1)

Extracted source (around line #3):

1: <form method="POST">
2: <%= @album_list = Album.find(:all, :order => "album_name")
3: form.select(:album_name, @album_list)
4: %>
5: </form>

Any help would be greatly appreciated
8cebb6913508306c81a2d90be55b216f?d=identicon&s=25 RailsNewby (Guest)
on 2007-05-10 02:31
Finally fixed it!

Needed to add the form_for wrapper.

here is the new code.

<% form_for :album, :url => { :action => :create } do |form| %>
<%= @album_list = Album.find(:all, :order => "album_name")
    form.select(:id, @album_list) %>
<% end %>



RailsNewby wrote:
> I am new to rails, PHP background. I'm completely lost on this. I am
> trying to pull all of the albums from the albums table into a select
> box. But every time I run the script I get the "wrong number of
> arguments (0 for 1)" error. I've looked on other message boards and
> searched the web but I can't seem to find the answer. I've tried several
> different variations of the form.select but they all lead to the same
> error.
>
> Oh, and I am using Instant Rails and this is a new application to this
> install.
>
> Here is the error:
>
>  ArgumentError in Admin#index
>
> Showing app/views/admin/index.rhtml where line #3 raised:
>
> wrong number of arguments (0 for 1)
>
> Extracted source (around line #3):
>
> 1: <form method="POST">
> 2: <%= @album_list = Album.find(:all, :order => "album_name")
> 3: form.select(:album_name, @album_list)
> 4: %>
> 5: </form>
>
> Any help would be greatly appreciated
This topic is locked and can not be replied to.