# Passing an Array as argument in a form\_for

**URL:** <https://www.ruby-forum.com/t/passing-an-array-as-argument-in-a-form-for/139966>\
**Category:** Rails\
**Created:** [June 9, 2008, 4:58pm UTC](https://www.ruby-forum.com/t/passing-an-array-as-argument-in-a-form-for/139966 "2008-06-09T16:58:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrjuniorsp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bb73d2/32.png) [@jrjuniorsp](https://www.ruby-forum.com/u/jrjuniorsp)\
**Post date:** [June 9, 2008, 4:58pm UTC](https://www.ruby-forum.com/t/passing-an-array-as-argument-in-a-form-for/139966/1 "2008-06-09T16:58:56Z")

</div>

Hi There,

I’ve got a question regarding RoR.  
In a single RHTML page, I am showing some values (from an Array) and  
also I have a form\_for.

I’d like to pass this Array to the form\_for (thus, I could get the array  
in the controller).

The Array is filled from a previous method

def get\_accounts  
if request.post?  
@list\_accounts = Account.find(:all,:order =\> “date  
asc”,:conditions =\> “date between ‘#{params[:initial\_date]}’ and  
‘#{params[:final\_date]}’”)  
end  
end

I’ve tried some approaches, such as:

\<% form\_for :accounts, :url =\> :action =\> :pay\_accounts, :list\_accounts  
=\> @list\_accounts, do |form| %\>

However, the hash map value for :list\_accounts is not getting the list  
of accounts, but the LASTEST ID from the object inside the list\_account.

Does anybody could help me?

Thanks in advice
