If your a seasoned Rails ninja, you might want to just skip this. However, if you have received this message in your rails application, the below might help you find what went wrong. This is by no means a end all solution, but I stumbled across this error just now and wanted to archive it in the case that I forget in the future. This error came from an attempt of using the following code: <div id="add_request_form">
<% form_remote_tag :url =>{:action=> :request_approval, :id=>@job.id },:update => 'request_history',
   :position => :bottom do  %>
    <label for="approver_request[message]" style="float: none; display: block; margin: 0, padding: 0; text-align: left;">Approval message</label>
    <%= text_area :approver_request, :message, :cols=>'60', :rows=>'7'%><br style="margin-top: 10px;" />
    <%= submit_tag "Request Approval"%>
<% end %>
</div>

<h4>Request History</h4>   
<dl id="request_history">

<% for ar in @approver_request do %>
    <dt>On <%= ar.created_at %> an approval request was sent to <%= User.find(ar.user_id).name %> (<%= User.find(ar.user_id).email %>)</dt>
    <dd><%= ar.message %></dd>
<% end %>

</dl>
Above, there is the code for sending a request for approving a job that has been entered into the web application. This code uses the remote_form_tag helper to allow updating the dl object without having to reload the page. However, the above code will produce the error of "undefined method `message' for #<Array:0x23022d8>"  because you cannot share the same variable on the page when one of them is being used for submitting data!! Here is what I ended up with: <div id="add_request_form">
<% form_remote_tag :url =>{:action=> :request_approval, :id=>@job.id },:update => 'request_history',
   :position => :bottom do  %>
    <label for="approver_request[message]" style="float: none; display: block; margin: 0, padding: 0; text-align: left;">Approval message</label>
    <%= text_area :approval_request, :message, :cols=>'60', :rows=>'7'%><br style="margin-top: 10px;" />
    <%= submit_tag "Request Approval"%>
<% end %>
</div>

<h4>Request History</h4>   
<dl id="request_history">

<% for ar in @approver_request do %>
    <dt>On <%= ar.created_at %> an approval request was sent to <%= User.find(ar.user_id).name %> (<%= User.find(ar.user_id).email %>)</dt>
    <dd><%= ar.message %></dd>
<% end %>

</dl>

comments powered by Disqus