# How to pass an array of model objects on a view

**URL:** <https://www.ruby-forum.com/t/how-to-pass-an-array-of-model-objects-on-a-view/109725>\
**Category:** Rails\
**Created:** [July 18, 2007, 11:59am UTC](https://www.ruby-forum.com/t/how-to-pass-an-array-of-model-objects-on-a-view/109725 "2007-07-18T11:59:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sven](https://www.ruby-forum.com/u/sven)\
**Post date:** [July 18, 2007, 11:59am UTC](https://www.ruby-forum.com/t/how-to-pass-an-array-of-model-objects-on-a-view/109725/1 "2007-07-18T11:59:17Z")

</div>

hello,

I am just beginning to understand how ruby on rails works. I have the  
following problem:

In the controller I would like to create an array of model objects:

@arr\_journeys = Array.new(3, Journey.new)

In the view I would like to do the following:

\<% for i in 1…4 %\>  
\<%= text\_field(@arr\_journeys[i], :quantity, :size =\> 6 %)\>  
\<% end\>

Is there any chance to do it like this? Do I have to write my own  
helpers?

Greets & thanks

Sven

---

<div class="post-metadata">

**Author:** ![sven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sven](https://www.ruby-forum.com/u/sven)\
**Post date:** [July 18, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/how-to-pass-an-array-of-model-objects-on-a-view/109725/2 "2007-07-18T12:36:23Z")

</div>

you almost got it

@arr\_journeys = …

\<% @arr\_journeys.each do |journey| -%\>  
…  
\<% end -%\>
