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:
2: <%= @album_list = Album.find(:all, :order => “album_name”)
3: form.select(:album_name, @album_list)
4: %>
5:
Any help would be greatly appreciated
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:
2: <%= @album_list = Album.find(:all, :order => “album_name”)
3: form.select(:album_name, @album_list)
4: %>
5:
Any help would be greatly appreciated