Reputation: 31
I get an error with the following code, but with a logger row or debug is the output correct. It's a little bit strange for me. (Rails 3.1.0 and 3.0.9 and Ruby 1.8.7)
Controller contains:
def index
@privatmessages = Privatmessage.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @privatmessages }
end
end
index.htm.erb
<% @privatmessages.each do |privatmessage| %>
<%= privatmessage.id %>
<% end %>
That code produce the error:
ArgumentError in Privatmessages#index Showing ../app/views/privatmessages/index.html.erb where line #2 raised: wrong number of arguments (1 for 0)
But the output is correct and without errors, if I add the following line at the controller:
logger.info "Messages: {#@privatmessages.to_yaml}"
or if I add inside of the each loop at the index.html.erb the line:
<%= debug privatmessage %>
Has anyone an advice for me?
Upvotes: 0
Views: 1425
Reputation: 31
Issue found and solved!
The problem was that I used "send" as a column name in the table, but "send" is a reserved method for Rails core. After renaming the column in the table to "sendout" it works.
Upvotes: 2